From 6db8d2dbb8b66cbed60fd15dd745b799291bdfad Mon Sep 17 00:00:00 2001 From: Aleksandra Malinowska Date: Wed, 21 Aug 2024 18:00:35 +0200 Subject: [PATCH 1/7] Fix update-codegen.sh --- cluster-autoscaler/hack/update-codegen.sh | 43 ++++++++++++++--------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/cluster-autoscaler/hack/update-codegen.sh b/cluster-autoscaler/hack/update-codegen.sh index b7793d6fc777..483393415b02 100755 --- a/cluster-autoscaler/hack/update-codegen.sh +++ b/cluster-autoscaler/hack/update-codegen.sh @@ -23,19 +23,30 @@ set -o errexit set -o nounset set -o pipefail -SCRIPT_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}"))/.. -CODEGEN_PKG="../vendor/k8s.io/code-generator" -pushd "${SCRIPT_ROOT}/apis" - -chmod +x "${CODEGEN_PKG}"/generate-groups.sh -chmod +x "${CODEGEN_PKG}"/generate-internal-groups.sh - -bash "${CODEGEN_PKG}"/generate-groups.sh "applyconfiguration,client,deepcopy,informer,lister" \ - k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client \ - k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest \ - autoscaling.x-k8s.io:v1beta1 \ - --go-header-file "${SCRIPT_ROOT}"/../hack/boilerplate/boilerplate.generatego.txt - -chmod -x "${CODEGEN_PKG}"/generate-groups.sh -chmod -x "${CODEGEN_PKG}"/generate-internal-groups.sh -popd +GO_CMD=${1:-go} +CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}") +REPO_ROOT="$(git rev-parse --show-toplevel)" +CODEGEN_PKG=$($GO_CMD list -m -mod=readonly -f "{{.Dir}}" k8s.io/code-generator) +cd "${CURRENT_DIR}/.." + +# shellcheck source=/dev/null +source "${CODEGEN_PKG}/kube_codegen.sh" + +kube::codegen::gen_helpers \ + --boilerplate "${REPO_ROOT}/hack/boilerplate/boilerplate.generatego.txt" \ + "${REPO_ROOT}/cluster-autoscaler/apis/provisioningrequest" + +echo "Ran gen helpers, moving on to generating client code..." + +kube::codegen::gen_client \ + --output-pkg k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client \ + --output-dir "${REPO_ROOT}/cluster-autoscaler/apis/provisioningrequest/client" \ + --boilerplate "${REPO_ROOT}/hack/boilerplate/boilerplate.generatego.txt" \ + --with-watch \ + --with-applyconfig \ + "${REPO_ROOT}/cluster-autoscaler/apis/provisioningrequest" + +echo "Generated client code, running `go mod tidy`..." + +# We need to clean up the go.mod file since code-generator adds temporary library to the go.mod file. +"${GO_CMD}" mod tidy From 850bd64b04c2134b5b5c4598db0d6d8a92bbc276 Mon Sep 17 00:00:00 2001 From: Aleksandra Malinowska Date: Wed, 21 Aug 2024 18:01:43 +0200 Subject: [PATCH 2/7] Temporarily make cluster-autoscaler/apis a package in cluster-autoscaler/ (remove go.mod) --- cluster-autoscaler/apis/go.mod | 60 ------------ cluster-autoscaler/apis/go.sum | 164 --------------------------------- cluster-autoscaler/go.mod | 11 +-- 3 files changed, 4 insertions(+), 231 deletions(-) delete mode 100644 cluster-autoscaler/apis/go.mod delete mode 100644 cluster-autoscaler/apis/go.sum diff --git a/cluster-autoscaler/apis/go.mod b/cluster-autoscaler/apis/go.mod deleted file mode 100644 index 14f2b5e9012c..000000000000 --- a/cluster-autoscaler/apis/go.mod +++ /dev/null @@ -1,60 +0,0 @@ -module k8s.io/autoscaler/cluster-autoscaler/apis - -go 1.22.0 - -require ( - github.com/onsi/ginkgo/v2 v2.19.0 - github.com/onsi/gomega v1.33.1 - k8s.io/apimachinery v0.31.0-alpha.2 - k8s.io/client-go v0.31.0-alpha.2 - k8s.io/code-generator v0.31.0-alpha.2 - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 -) - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/fxamacker/cbor/v2 v2.7.0-beta // indirect - github.com/go-logr/logr v1.4.1 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.4 // indirect - github.com/go-task/slim-sprig/v3 v3.0.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.7.7 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/x448/float16 v0.8.4 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/term v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.21.0 // indirect - google.golang.org/protobuf v1.33.0 // indirect - gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.31.0-alpha.2 // indirect - k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect - k8s.io/klog/v2 v2.120.1 // indirect - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/yaml v1.4.0 // indirect -) diff --git a/cluster-autoscaler/apis/go.sum b/cluster-autoscaler/apis/go.sum deleted file mode 100644 index ca3f084137b8..000000000000 --- a/cluster-autoscaler/apis/go.sum +++ /dev/null @@ -1,164 +0,0 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -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= -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.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/fxamacker/cbor/v2 v2.7.0-beta h1:m5bO941uTVpSms26QjzEJxUZaC3S/h1pSJexBCu4wAA= -github.com/fxamacker/cbor/v2 v2.7.0-beta/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -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/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= -github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= -github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -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= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/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.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= -github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= -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= -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= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= -github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -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.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= -golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -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= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -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= -gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= -gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= -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.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -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/api v0.31.0-alpha.2 h1:azMbpAFERqtGmgDtg/f7efnxgPBW+8ieyHNKxT97EMI= -k8s.io/api v0.31.0-alpha.2/go.mod h1:S1X5UjUV8NZmR1vmKIkUpruhr0AWAvocZVZ5zxKMvi4= -k8s.io/apimachinery v0.31.0-alpha.2 h1:jya7Ax6yRLH+CSW/osUEO+hxe4rVNrXU8lNB0fZcGkk= -k8s.io/apimachinery v0.31.0-alpha.2/go.mod h1:3nAExNh3CrzC6eKT9a32j/rv+uJ8Zod87oOmgUjZNAY= -k8s.io/client-go v0.31.0-alpha.2 h1:13UCBphjOLcqQ1ROBA+y9sr9Bmc/Ss1ypHQEDb6uKas= -k8s.io/client-go v0.31.0-alpha.2/go.mod h1:wF4N5QBYqOoXntvUsYd5eyfDLqskc/UNDyEF6WvaFIk= -k8s.io/code-generator v0.31.0-alpha.2 h1:ZgL/AgAXFbZ4P32Rrv2FFxQPU2MKTdNd4RTVAipCQlE= -k8s.io/code-generator v0.31.0-alpha.2/go.mod h1:4hS5z9BqvAr5Lup7NsSAh2iXug1I6KVB5x9bnQD1w8k= -k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= -k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/cluster-autoscaler/go.mod b/cluster-autoscaler/go.mod index 7341cbd08217..120afa9adb59 100644 --- a/cluster-autoscaler/go.mod +++ b/cluster-autoscaler/go.mod @@ -28,6 +28,8 @@ require ( github.com/jmattheis/goverter v1.4.0 github.com/jmespath/go-jmespath v0.4.0 github.com/json-iterator/go v1.1.12 + github.com/onsi/ginkgo/v2 v2.19.0 + github.com/onsi/gomega v1.33.1 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.19.1 github.com/spf13/pflag v1.0.5 @@ -45,11 +47,11 @@ require ( k8s.io/api v0.31.0-beta.0 k8s.io/apimachinery v0.31.0-beta.0 k8s.io/apiserver v0.31.0-beta.0 - k8s.io/autoscaler/cluster-autoscaler/apis v0.0.0-20240627115740-d52e4b9665d7 k8s.io/client-go v0.31.0-beta.0 k8s.io/cloud-provider v0.30.0-alpha.3 k8s.io/cloud-provider-aws v1.27.0 k8s.io/cloud-provider-gcp/providers v0.28.2 + k8s.io/code-generator v0.31.0-beta.0 k8s.io/component-base v0.31.0-beta.0 k8s.io/component-helpers v0.31.0-beta.0 k8s.io/klog/v2 v2.130.1 @@ -57,6 +59,7 @@ require ( k8s.io/kubernetes v1.31.0-beta.0 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 sigs.k8s.io/cloud-provider-azure v1.29.4 + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 sigs.k8s.io/yaml v1.4.0 ) @@ -151,8 +154,6 @@ require ( github.com/mrunalp/fileutils v0.5.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect - github.com/onsi/ginkgo/v2 v2.19.0 // indirect - github.com/onsi/gomega v1.33.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/runc v1.1.13 // indirect github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78 // indirect @@ -203,7 +204,6 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.0.0 // indirect - k8s.io/code-generator v0.31.0-beta.0 // indirect k8s.io/controller-manager v0.31.0-beta.0 // indirect k8s.io/cri-api v0.31.0-beta.0 // indirect k8s.io/cri-client v0.0.0 // indirect @@ -219,7 +219,6 @@ require ( sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.13 // indirect sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.4 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) replace github.com/aws/aws-sdk-go/service/eks => github.com/aws/aws-sdk-go/service/eks v1.38.49 @@ -286,6 +285,4 @@ replace k8s.io/kms => k8s.io/kms v0.31.0-beta.0 replace k8s.io/endpointslice => k8s.io/endpointslice v0.31.0-beta.0 -replace k8s.io/autoscaler/cluster-autoscaler/apis => ./apis - replace k8s.io/cri-client => k8s.io/cri-client v0.31.0-beta.0 From c4368d4b97c63df387f00c66c4939161ea33c09f Mon Sep 17 00:00:00 2001 From: Aleksandra Malinowska Date: Wed, 21 Aug 2024 18:17:13 +0200 Subject: [PATCH 3/7] Regenerate ProvisioningRequest v1beta1 client using newer codegen --- .../v1beta1/zz_generated.defaults.go | 33 +++ .../autoscaling.x-k8s.io/v1beta1/podset.go | 4 +- .../v1beta1/provisioningrequest.go | 10 +- .../v1beta1/provisioningrequestspec.go | 4 +- .../v1beta1/provisioningrequeststatus.go | 17 +- .../autoscaling.x-k8s.io/v1beta1/reference.go | 4 +- .../client/applyconfiguration/utils.go | 7 + .../versioned/fake/clientset_generated.go | 39 +++- .../v1beta1/fake/fake_provisioningrequest.go | 46 ++-- .../v1beta1/provisioningrequest.go | 205 +----------------- .../v1beta1/provisioningrequest.go | 39 +--- 11 files changed, 145 insertions(+), 263 deletions(-) create mode 100644 cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1/zz_generated.defaults.go diff --git a/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1/zz_generated.defaults.go b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1/zz_generated.defaults.go new file mode 100644 index 000000000000..198b5be4af53 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1/zz_generated.defaults.go @@ -0,0 +1,33 @@ +//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 defaulter-gen. DO NOT EDIT. + +package v1beta1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// 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 +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/podset.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/podset.go index b65221d8021b..df5113869b57 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/podset.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/podset.go @@ -18,14 +18,14 @@ limitations under the License. package v1beta1 -// PodSetApplyConfiguration represents an declarative configuration of the PodSet type for use +// PodSetApplyConfiguration represents a declarative configuration of the PodSet type for use // with apply. type PodSetApplyConfiguration struct { PodTemplateRef *ReferenceApplyConfiguration `json:"podTemplateRef,omitempty"` Count *int32 `json:"count,omitempty"` } -// PodSetApplyConfiguration constructs an declarative configuration of the PodSet type for use with +// PodSetApplyConfiguration constructs a declarative configuration of the PodSet type for use with // apply. func PodSet() *PodSetApplyConfiguration { return &PodSetApplyConfiguration{} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go index 7a420da3c42a..b712828dd539 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go @@ -24,7 +24,7 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ProvisioningRequestApplyConfiguration represents an declarative configuration of the ProvisioningRequest type for use +// ProvisioningRequestApplyConfiguration represents a declarative configuration of the ProvisioningRequest type for use // with apply. type ProvisioningRequestApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -33,7 +33,7 @@ type ProvisioningRequestApplyConfiguration struct { Status *ProvisioningRequestStatusApplyConfiguration `json:"status,omitempty"` } -// ProvisioningRequest constructs an declarative configuration of the ProvisioningRequest type for use with +// ProvisioningRequest constructs a declarative configuration of the ProvisioningRequest type for use with // apply. func ProvisioningRequest(name, namespace string) *ProvisioningRequestApplyConfiguration { b := &ProvisioningRequestApplyConfiguration{} @@ -217,3 +217,9 @@ func (b *ProvisioningRequestApplyConfiguration) WithStatus(value *ProvisioningRe b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ProvisioningRequestApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequestspec.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequestspec.go index 1c523729260e..bd8849afb998 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequestspec.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequestspec.go @@ -22,7 +22,7 @@ import ( autoscalingxk8siov1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" ) -// ProvisioningRequestSpecApplyConfiguration represents an declarative configuration of the ProvisioningRequestSpec type for use +// ProvisioningRequestSpecApplyConfiguration represents a declarative configuration of the ProvisioningRequestSpec type for use // with apply. type ProvisioningRequestSpecApplyConfiguration struct { PodSets []PodSetApplyConfiguration `json:"podSets,omitempty"` @@ -30,7 +30,7 @@ type ProvisioningRequestSpecApplyConfiguration struct { Parameters map[string]autoscalingxk8siov1beta1.Parameter `json:"parameters,omitempty"` } -// ProvisioningRequestSpecApplyConfiguration constructs an declarative configuration of the ProvisioningRequestSpec type for use with +// ProvisioningRequestSpecApplyConfiguration constructs a declarative configuration of the ProvisioningRequestSpec type for use with // apply. func ProvisioningRequestSpec() *ProvisioningRequestSpecApplyConfiguration { return &ProvisioningRequestSpecApplyConfiguration{} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequeststatus.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequeststatus.go index f949fffafd22..19ada98c8e8d 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequeststatus.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/provisioningrequeststatus.go @@ -19,18 +19,18 @@ limitations under the License. package v1beta1 import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// ProvisioningRequestStatusApplyConfiguration represents an declarative configuration of the ProvisioningRequestStatus type for use +// ProvisioningRequestStatusApplyConfiguration represents a declarative configuration of the ProvisioningRequestStatus type for use // with apply. type ProvisioningRequestStatusApplyConfiguration struct { - Conditions []v1.Condition `json:"conditions,omitempty"` - ProvisioningClassDetails map[string]v1beta1.Detail `json:"provisioningClassDetails,omitempty"` + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + ProvisioningClassDetails map[string]v1beta1.Detail `json:"provisioningClassDetails,omitempty"` } -// ProvisioningRequestStatusApplyConfiguration constructs an declarative configuration of the ProvisioningRequestStatus type for use with +// ProvisioningRequestStatusApplyConfiguration constructs a declarative configuration of the ProvisioningRequestStatus type for use with // apply. func ProvisioningRequestStatus() *ProvisioningRequestStatusApplyConfiguration { return &ProvisioningRequestStatusApplyConfiguration{} @@ -39,9 +39,12 @@ func ProvisioningRequestStatus() *ProvisioningRequestStatusApplyConfiguration { // 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 *ProvisioningRequestStatusApplyConfiguration) WithConditions(values ...v1.Condition) *ProvisioningRequestStatusApplyConfiguration { +func (b *ProvisioningRequestStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ProvisioningRequestStatusApplyConfiguration { for i := range values { - b.Conditions = append(b.Conditions, values[i]) + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) } return b } diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/reference.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/reference.go index e395468feef4..8caf360aebc7 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/reference.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1/reference.go @@ -18,13 +18,13 @@ limitations under the License. package v1beta1 -// ReferenceApplyConfiguration represents an declarative configuration of the Reference type for use +// ReferenceApplyConfiguration represents a declarative configuration of the Reference type for use // with apply. type ReferenceApplyConfiguration struct { Name *string `json:"name,omitempty"` } -// ReferenceApplyConfiguration constructs an declarative configuration of the Reference type for use with +// ReferenceApplyConfiguration constructs a declarative configuration of the Reference type for use with // apply. func Reference() *ReferenceApplyConfiguration { return &ReferenceApplyConfiguration{} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/utils.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/utils.go index 894c18a44998..0b20db246cb1 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/utils.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/utils.go @@ -19,9 +19,12 @@ limitations under the License. package applyconfiguration import ( + runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" v1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" autoscalingxk8siov1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1" + internal "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/internal" + testing "k8s.io/client-go/testing" ) // ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no @@ -43,3 +46,7 @@ func ForKind(kind schema.GroupVersionKind) interface{} { } return nil } + +func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter { + return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()} +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/clientset_generated.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/clientset_generated.go index eb8263030374..ca056dc72316 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/clientset_generated.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/clientset_generated.go @@ -21,6 +21,7 @@ package fake import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" + applyconfiguration "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration" clientset "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned" autoscalingv1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1" fakeautoscalingv1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/fake" @@ -31,8 +32,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // 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 +// 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 { @@ -74,6 +79,38 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } +// NewClientset returns a clientset that will respond with the provided objects. +// 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. +func NewClientset(objects ...runtime.Object) *Clientset { + o := testing.NewFieldManagedObjectTracker( + scheme, + codecs.UniversalDecoder(), + applyconfiguration.NewTypeConverter(scheme), + ) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + var ( _ clientset.Interface = &Clientset{} _ testing.FakeClient = &Clientset{} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/fake/fake_provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/fake/fake_provisioningrequest.go index 0ec6755ad4ba..df35385e542f 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/fake/fake_provisioningrequest.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/fake/fake_provisioningrequest.go @@ -44,22 +44,24 @@ var provisioningrequestsKind = v1beta1.SchemeGroupVersion.WithKind("Provisioning // Get takes name of the provisioningRequest, and returns the corresponding provisioningRequest object, and an error if there is any. func (c *FakeProvisioningRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ProvisioningRequest, err error) { + emptyResult := &v1beta1.ProvisioningRequest{} obj, err := c.Fake. - Invokes(testing.NewGetAction(provisioningrequestsResource, c.ns, name), &v1beta1.ProvisioningRequest{}) + Invokes(testing.NewGetActionWithOptions(provisioningrequestsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ProvisioningRequest), err } // List takes label and field selectors, and returns the list of ProvisioningRequests that match those selectors. func (c *FakeProvisioningRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ProvisioningRequestList, err error) { + emptyResult := &v1beta1.ProvisioningRequestList{} obj, err := c.Fake. - Invokes(testing.NewListAction(provisioningrequestsResource, provisioningrequestsKind, c.ns, opts), &v1beta1.ProvisioningRequestList{}) + Invokes(testing.NewListActionWithOptions(provisioningrequestsResource, provisioningrequestsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeProvisioningRequests) List(ctx context.Context, opts v1.ListOptions // Watch returns a watch.Interface that watches the requested provisioningRequests. func (c *FakeProvisioningRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(provisioningrequestsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(provisioningrequestsResource, c.ns, opts)) } // Create takes the representation of a provisioningRequest and creates it. Returns the server's representation of the provisioningRequest, and an error, if there is any. func (c *FakeProvisioningRequests) Create(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.CreateOptions) (result *v1beta1.ProvisioningRequest, err error) { + emptyResult := &v1beta1.ProvisioningRequest{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(provisioningrequestsResource, c.ns, provisioningRequest), &v1beta1.ProvisioningRequest{}) + Invokes(testing.NewCreateActionWithOptions(provisioningrequestsResource, c.ns, provisioningRequest, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ProvisioningRequest), err } // Update takes the representation of a provisioningRequest and updates it. Returns the server's representation of the provisioningRequest, and an error, if there is any. func (c *FakeProvisioningRequests) Update(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.UpdateOptions) (result *v1beta1.ProvisioningRequest, err error) { + emptyResult := &v1beta1.ProvisioningRequest{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(provisioningrequestsResource, c.ns, provisioningRequest), &v1beta1.ProvisioningRequest{}) + Invokes(testing.NewUpdateActionWithOptions(provisioningrequestsResource, c.ns, provisioningRequest, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ProvisioningRequest), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeProvisioningRequests) UpdateStatus(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.UpdateOptions) (*v1beta1.ProvisioningRequest, error) { +func (c *FakeProvisioningRequests) UpdateStatus(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.UpdateOptions) (result *v1beta1.ProvisioningRequest, err error) { + emptyResult := &v1beta1.ProvisioningRequest{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(provisioningrequestsResource, "status", c.ns, provisioningRequest), &v1beta1.ProvisioningRequest{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(provisioningrequestsResource, "status", c.ns, provisioningRequest, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ProvisioningRequest), err } @@ -126,7 +131,7 @@ func (c *FakeProvisioningRequests) Delete(ctx context.Context, name string, opts // DeleteCollection deletes a collection of objects. func (c *FakeProvisioningRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(provisioningrequestsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(provisioningrequestsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.ProvisioningRequestList{}) return err @@ -134,11 +139,12 @@ func (c *FakeProvisioningRequests) DeleteCollection(ctx context.Context, opts v1 // Patch applies the patch and returns the patched provisioningRequest. func (c *FakeProvisioningRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ProvisioningRequest, err error) { + emptyResult := &v1beta1.ProvisioningRequest{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(provisioningrequestsResource, c.ns, name, pt, data, subresources...), &v1beta1.ProvisioningRequest{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(provisioningrequestsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ProvisioningRequest), err } @@ -156,11 +162,12 @@ func (c *FakeProvisioningRequests) Apply(ctx context.Context, provisioningReques if name == nil { return nil, fmt.Errorf("provisioningRequest.Name must be provided to Apply") } + emptyResult := &v1beta1.ProvisioningRequest{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(provisioningrequestsResource, c.ns, *name, types.ApplyPatchType, data), &v1beta1.ProvisioningRequest{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(provisioningrequestsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ProvisioningRequest), err } @@ -179,11 +186,12 @@ func (c *FakeProvisioningRequests) ApplyStatus(ctx context.Context, provisioning if name == nil { return nil, fmt.Errorf("provisioningRequest.Name must be provided to Apply") } + emptyResult := &v1beta1.ProvisioningRequest{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(provisioningrequestsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1beta1.ProvisioningRequest{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(provisioningrequestsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ProvisioningRequest), err } diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go index df19e1075a67..4641861abf44 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go @@ -20,9 +20,6 @@ package v1beta1 import ( "context" - json "encoding/json" - "fmt" - "time" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -30,7 +27,7 @@ import ( v1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" autoscalingxk8siov1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1" scheme "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ProvisioningRequestsGetter has a method to return a ProvisioningRequestInterface. @@ -43,6 +40,7 @@ type ProvisioningRequestsGetter interface { type ProvisioningRequestInterface interface { Create(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.CreateOptions) (*v1beta1.ProvisioningRequest, error) Update(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.UpdateOptions) (*v1beta1.ProvisioningRequest, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.UpdateOptions) (*v1beta1.ProvisioningRequest, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type ProvisioningRequestInterface interface { 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 *v1beta1.ProvisioningRequest, err error) Apply(ctx context.Context, provisioningRequest *autoscalingxk8siov1beta1.ProvisioningRequestApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ProvisioningRequest, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, provisioningRequest *autoscalingxk8siov1beta1.ProvisioningRequestApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ProvisioningRequest, err error) ProvisioningRequestExpansion } // provisioningRequests implements ProvisioningRequestInterface type provisioningRequests struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1beta1.ProvisioningRequest, *v1beta1.ProvisioningRequestList, *autoscalingxk8siov1beta1.ProvisioningRequestApplyConfiguration] } // newProvisioningRequests returns a ProvisioningRequests func newProvisioningRequests(c *AutoscalingV1beta1Client, namespace string) *provisioningRequests { return &provisioningRequests{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1beta1.ProvisioningRequest, *v1beta1.ProvisioningRequestList, *autoscalingxk8siov1beta1.ProvisioningRequestApplyConfiguration]( + "provisioningrequests", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.ProvisioningRequest { return &v1beta1.ProvisioningRequest{} }, + func() *v1beta1.ProvisioningRequestList { return &v1beta1.ProvisioningRequestList{} }), } } - -// Get takes name of the provisioningRequest, and returns the corresponding provisioningRequest object, and an error if there is any. -func (c *provisioningRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ProvisioningRequest, err error) { - result = &v1beta1.ProvisioningRequest{} - err = c.client.Get(). - Namespace(c.ns). - Resource("provisioningrequests"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ProvisioningRequests that match those selectors. -func (c *provisioningRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ProvisioningRequestList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.ProvisioningRequestList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("provisioningrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested provisioningRequests. -func (c *provisioningRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("provisioningrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a provisioningRequest and creates it. Returns the server's representation of the provisioningRequest, and an error, if there is any. -func (c *provisioningRequests) Create(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.CreateOptions) (result *v1beta1.ProvisioningRequest, err error) { - result = &v1beta1.ProvisioningRequest{} - err = c.client.Post(). - Namespace(c.ns). - Resource("provisioningrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(provisioningRequest). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a provisioningRequest and updates it. Returns the server's representation of the provisioningRequest, and an error, if there is any. -func (c *provisioningRequests) Update(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.UpdateOptions) (result *v1beta1.ProvisioningRequest, err error) { - result = &v1beta1.ProvisioningRequest{} - err = c.client.Put(). - Namespace(c.ns). - Resource("provisioningrequests"). - Name(provisioningRequest.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(provisioningRequest). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *provisioningRequests) UpdateStatus(ctx context.Context, provisioningRequest *v1beta1.ProvisioningRequest, opts v1.UpdateOptions) (result *v1beta1.ProvisioningRequest, err error) { - result = &v1beta1.ProvisioningRequest{} - err = c.client.Put(). - Namespace(c.ns). - Resource("provisioningrequests"). - Name(provisioningRequest.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(provisioningRequest). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the provisioningRequest and deletes it. Returns an error if one occurs. -func (c *provisioningRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("provisioningrequests"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *provisioningRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("provisioningrequests"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched provisioningRequest. -func (c *provisioningRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ProvisioningRequest, err error) { - result = &v1beta1.ProvisioningRequest{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("provisioningrequests"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied provisioningRequest. -func (c *provisioningRequests) Apply(ctx context.Context, provisioningRequest *autoscalingxk8siov1beta1.ProvisioningRequestApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ProvisioningRequest, err error) { - if provisioningRequest == nil { - return nil, fmt.Errorf("provisioningRequest provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(provisioningRequest) - if err != nil { - return nil, err - } - name := provisioningRequest.Name - if name == nil { - return nil, fmt.Errorf("provisioningRequest.Name must be provided to Apply") - } - result = &v1beta1.ProvisioningRequest{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("provisioningrequests"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *provisioningRequests) ApplyStatus(ctx context.Context, provisioningRequest *autoscalingxk8siov1beta1.ProvisioningRequestApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ProvisioningRequest, err error) { - if provisioningRequest == nil { - return nil, fmt.Errorf("provisioningRequest provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(provisioningRequest) - if err != nil { - return nil, err - } - - name := provisioningRequest.Name - if name == nil { - return nil, fmt.Errorf("provisioningRequest.Name must be provided to Apply") - } - - result = &v1beta1.ProvisioningRequest{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("provisioningrequests"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go index 4073183123cc..edc1d0ab77e1 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1beta1/provisioningrequest.go @@ -19,9 +19,9 @@ limitations under the License. package v1beta1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" v1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" ) @@ -38,25 +38,17 @@ type ProvisioningRequestLister interface { // provisioningRequestLister implements the ProvisioningRequestLister interface. type provisioningRequestLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.ProvisioningRequest] } // NewProvisioningRequestLister returns a new ProvisioningRequestLister. func NewProvisioningRequestLister(indexer cache.Indexer) ProvisioningRequestLister { - return &provisioningRequestLister{indexer: indexer} -} - -// List lists all ProvisioningRequests in the indexer. -func (s *provisioningRequestLister) List(selector labels.Selector) (ret []*v1beta1.ProvisioningRequest, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.ProvisioningRequest)) - }) - return ret, err + return &provisioningRequestLister{listers.New[*v1beta1.ProvisioningRequest](indexer, v1beta1.Resource("provisioningrequest"))} } // ProvisioningRequests returns an object that can list and get ProvisioningRequests. func (s *provisioningRequestLister) ProvisioningRequests(namespace string) ProvisioningRequestNamespaceLister { - return provisioningRequestNamespaceLister{indexer: s.indexer, namespace: namespace} + return provisioningRequestNamespaceLister{listers.NewNamespaced[*v1beta1.ProvisioningRequest](s.ResourceIndexer, namespace)} } // ProvisioningRequestNamespaceLister helps list and get ProvisioningRequests. @@ -74,26 +66,5 @@ type ProvisioningRequestNamespaceLister interface { // provisioningRequestNamespaceLister implements the ProvisioningRequestNamespaceLister // interface. type provisioningRequestNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ProvisioningRequests in the indexer for a given namespace. -func (s provisioningRequestNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ProvisioningRequest, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.ProvisioningRequest)) - }) - return ret, err -} - -// Get retrieves the ProvisioningRequest from the indexer for a given namespace and name. -func (s provisioningRequestNamespaceLister) Get(name string) (*v1beta1.ProvisioningRequest, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("provisioningrequest"), name) - } - return obj.(*v1beta1.ProvisioningRequest), nil + listers.ResourceIndexer[*v1beta1.ProvisioningRequest] } From fbfa08140ffbe8b1fbb937a781eb9b6f3cc5fd7b Mon Sep 17 00:00:00 2001 From: Aleksandra Malinowska Date: Wed, 21 Aug 2024 18:12:04 +0200 Subject: [PATCH 4/7] Add API types for ProvisioningRequest v1 --- .../autoscaling.x-k8s.io/v1/doc.go | 21 ++ .../autoscaling.x-k8s.io/v1/register.go | 56 +++++ .../autoscaling.x-k8s.io/v1/types.go | 207 ++++++++++++++++++ 3 files changed, 284 insertions(+) create mode 100644 cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/doc.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/register.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/types.go diff --git a/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/doc.go b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/doc.go new file mode 100644 index 000000000000..db9cbf92cfc6 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/doc.go @@ -0,0 +1,21 @@ +/* +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 v1 contains definitions of Provisioning Request related objects. +// +k8s:deepcopy-gen=package +// +k8s:defaulter-gen=TypeMeta +// +groupName=autoscaling.x-k8s.io +package v1 diff --git a/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/register.go b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/register.go new file mode 100644 index 000000000000..543751d0c954 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/register.go @@ -0,0 +1,56 @@ +/* +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 v1 contains definitions of Provisioning Request related objects. +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + // GroupName represents the group name for ProvisioningRequest resources. + GroupName = "autoscaling.x-k8s.io" + // GroupVersion represents the group name for ProvisioningRequest resources. + GroupVersion = "v1" +) + +// SchemeGroupVersion represents the group version object for ProvisioningRequest scheme. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} + +var ( + // SchemeBuilder is the scheme builder for ProvisioningRequest. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is the func that applies all the stored functions to the scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &ProvisioningRequest{}, + &ProvisioningRequestList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/types.go b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/types.go new file mode 100644 index 000000000000..3a2deb057ad9 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/types.go @@ -0,0 +1,207 @@ +/* +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 v1 contains definitions of Provisioning Request related objects. +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + // Dependencies for the generation of the code: + _ "github.com/onsi/ginkgo/v2" + _ "github.com/onsi/gomega" + _ "k8s.io/code-generator" +) + +// +genclient +// +kubebuilder:storageversions +// +kubebuilder:resource:shortName=provreq;provreqs + +// ProvisioningRequest is a way to express additional capacity +// that we would like to provision in the cluster. Cluster Autoscaler +// can use this information in its calculations and signal if the capacity +// is available in the cluster or actively add capacity if needed. +// +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ProvisioningRequest struct { + metav1.TypeMeta `json:",inline"` + // Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec contains specification of the ProvisioningRequest object. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status. + // The spec is immutable, to make changes to the request users are expected to delete an existing + // and create a new object with the corrected fields. + // + // +kubebuilder:validation:Required + Spec ProvisioningRequestSpec `json:"spec"` + // Status of the ProvisioningRequest. CA constantly reconciles this field. + // + // +optional + Status ProvisioningRequestStatus `json:"status,omitempty"` +} + +// ProvisioningRequestList is a object for list of ProvisioningRequest. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ProvisioningRequestList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata. + // + // +optional + metav1.ListMeta `json:"metadata"` + // Items, list of ProvisioningRequest returned from API. + // + // +optional + Items []ProvisioningRequest `json:"items"` +} + +// ProvisioningRequestSpec is a specification of additional pods for which we +// would like to provision additional resources in the cluster. +type ProvisioningRequestSpec struct { + // PodSets lists groups of pods for which we would like to provision + // resources. + // + // +kubebuilder:validation:Required + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=32 + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable" + PodSets []PodSet `json:"podSets"` + + // ProvisioningClassName describes the different modes of provisioning the resources. + // Currently there is no support for 'ProvisioningClass' objects. + // Supported values: + // * check-capacity.kubernetes.io - check if current cluster state can fullfil this request, + // do not reserve the capacity. Users should provide a reference to a valid PodTemplate object. + // CA will check if there is enough capacity in cluster to fulfill the request and put + // the answer in 'CapacityAvailable' condition. + // * atomic-scale-up.kubernetes.io - provision the resources in an atomic manner. + // Users should provide a reference to a valid PodTemplate object. + // CA will try to create the VMs in an atomic manner, clean any partially provisioned VMs + // and re-try the operation in a exponential back-off manner. Users can configure the timeout + // duration after which the request will fail by 'ValidUntilSeconds' key in 'Parameters'. + // CA will set 'Failed=true' or 'Provisioned=true' condition according to the outcome. + // * ... - potential other classes that are specific to the cloud providers. + // 'kubernetes.io' suffix is reserved for the modes defined in Kubernetes projects. + // + // +kubebuilder:validation:Required + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable" + // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` + // +kubebuilder:validation:MaxLength=253 + ProvisioningClassName string `json:"provisioningClassName"` + + // Parameters contains all other parameters classes may require. + // 'atomic-scale-up.kubernetes.io' supports 'ValidUntilSeconds' parameter, which should contain + // a string denoting duration for which we should retry (measured since creation fo the CR). + // + // +optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable" + // +kubebuilder:validation:MaxProperties=100 + Parameters map[string]Parameter `json:"parameters"` +} + +// Parameter is limited to 255 characters. +// +kubebuilder:validation:MaxLength=255 +type Parameter string + +// PodSet represents one group of pods for Provisioning Request to provision capacity. +type PodSet struct { + // PodTemplateRef is a reference to a PodTemplate object that is representing pods + // that will consume this reservation (must be within the same namespace). + // Users need to make sure that the fields relevant to scheduler (e.g. node selector tolerations) + // are consistent between this template and actual pods consuming the Provisioning Request. + // + // +kubebuilder:validation:Required + PodTemplateRef Reference `json:"podTemplateRef"` + // Count contains the number of pods that will be created with a given + // template. + // + // +kubebuilder:validation:Minimum=1 + Count int32 `json:"count"` +} + +// Reference represents reference to an object within the same namespace. +type Reference struct { + // Name of the referenced object. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + // + // +kubebuilder:validation:Required + // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` + // +kubebuilder:validation:MaxLength=253 + Name string `json:"name,omitempty"` +} + +// ProvisioningRequestStatus represents the status of the resource reservation. +type ProvisioningRequestStatus struct { + // Conditions represent the observations of a Provisioning Request's + // current state. Those will contain information whether the capacity + // was found/created or if there were any issues. The condition types + // may differ between different provisioning classes. + // + // +listType=map + // +listMapKey=type + // +patchStrategy=merge + // +patchMergeKey=type + // +optional + Conditions []metav1.Condition `json:"conditions"` + + // ProvisioningClassDetails contains all other values custom provisioning classes may + // want to pass to end users. + // + // +optional + // +kubebuilder:validation:MaxProperties=64 + ProvisioningClassDetails map[string]Detail `json:"provisioningClassDetails"` +} + +// Detail is limited to 32768 characters. +// +kubebuilder:validation:MaxLength=32768 +type Detail string + +// The following constants list all currently available Conditions Type values. +// See: https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Condition +const ( + // Accepted indicates that the ProvisioningRequest was accepted by ClusterAutoscaler, + // so ClusterAutoscaler will attempt to provision the nodes for it. + Accepted string = "Accepted" + // BookingExpired indicates that the ProvisioningRequest had Provisioned condition before + // and capacity reservation time is expired. + BookingExpired string = "BookingExpired" + // CapacityRevoked indicates that requested resources are not longer valid. + CapacityRevoked string = "CapacityRevoked" + // Provisioned indicates that all of the requested resources were created + // and registered in the cluster. CA will set this condition when the + // VM creation finishes successfully. + Provisioned string = "Provisioned" + // Failed indicates that it is impossible to obtain resources to fulfill + // this ProvisioningRequest. + // Condition Reason and Message will contain more details about what failed. + Failed string = "Failed" +) + +const ( + // ProvisioningClassCheckCapacity denotes that CA will check if current cluster state can fulfill this request, + // and reserve the capacity for a specified time. + ProvisioningClassCheckCapacity string = "check-capacity.autoscaling.x-k8s.io" + // ProvisioningClassBestEffortAtomicScaleUp denotes that CA try to provision the capacity + // in an atomic manner. + ProvisioningClassBestEffortAtomicScaleUp string = "best-effort-atomic-scale-up.autoscaling.x-k8s.io" + // ProvisioningRequestPodAnnotationKey is a key used to annotate pods consuming provisioning request. + ProvisioningRequestPodAnnotationKey = "autoscaling.x-k8s.io/consume-provisioning-request" + // ProvisioningClassPodAnnotationKey is a key used to add annotation about Provisioning Class + ProvisioningClassPodAnnotationKey = "autoscaling.x-k8s.io/provisioning-class-name" +) From 23fcf7ec7c7864a1cc11254187714ab37b74e665 Mon Sep 17 00:00:00 2001 From: Aleksandra Malinowska Date: Wed, 21 Aug 2024 18:18:42 +0200 Subject: [PATCH 5/7] Generate ProvisioningRequest v1 client --- .../v1/zz_generated.deepcopy.go | 179 ++++++++++++++ .../v1/zz_generated.defaults.go | 33 +++ .../autoscaling.x-k8s.io/v1/podset.go | 48 ++++ .../v1/provisioningrequest.go | 225 ++++++++++++++++++ .../v1/provisioningrequestspec.go | 72 ++++++ .../v1/provisioningrequeststatus.go | 64 +++++ .../autoscaling.x-k8s.io/v1/reference.go | 39 +++ .../client/applyconfiguration/utils.go | 16 +- .../client/clientset/versioned/clientset.go | 13 + .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../v1/autoscaling.x-k8s.io_client.go | 107 +++++++++ .../typed/autoscaling.x-k8s.io/v1/doc.go | 20 ++ .../typed/autoscaling.x-k8s.io/v1/fake/doc.go | 20 ++ .../fake/fake_autoscaling.x-k8s.io_client.go | 40 ++++ .../v1/fake/fake_provisioningrequest.go | 197 +++++++++++++++ .../v1/generated_expansion.go | 21 ++ .../v1/provisioningrequest.go | 73 ++++++ .../autoscaling.x-k8s.io/interface.go | 8 + .../autoscaling.x-k8s.io/v1/interface.go | 45 ++++ .../v1/provisioningrequest.go | 90 +++++++ .../informers/externalversions/generic.go | 7 +- .../v1/expansion_generated.go | 27 +++ .../v1/provisioningrequest.go | 70 ++++++ 25 files changed, 1423 insertions(+), 2 deletions(-) create mode 100644 cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/zz_generated.deepcopy.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/zz_generated.defaults.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/podset.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequest.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequestspec.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequeststatus.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/reference.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/autoscaling.x-k8s.io_client.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/doc.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/doc.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/fake_autoscaling.x-k8s.io_client.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/fake_provisioningrequest.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/generated_expansion.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/provisioningrequest.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1/interface.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1/provisioningrequest.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1/expansion_generated.go create mode 100644 cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1/provisioningrequest.go diff --git a/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/zz_generated.deepcopy.go b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/zz_generated.deepcopy.go new file mode 100644 index 000000000000..0589d3dd140f --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/zz_generated.deepcopy.go @@ -0,0 +1,179 @@ +//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 ( + metav1 "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 *PodSet) DeepCopyInto(out *PodSet) { + *out = *in + out.PodTemplateRef = in.PodTemplateRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSet. +func (in *PodSet) DeepCopy() *PodSet { + if in == nil { + return nil + } + out := new(PodSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProvisioningRequest) DeepCopyInto(out *ProvisioningRequest) { + *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 ProvisioningRequest. +func (in *ProvisioningRequest) DeepCopy() *ProvisioningRequest { + if in == nil { + return nil + } + out := new(ProvisioningRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProvisioningRequest) 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 *ProvisioningRequestList) DeepCopyInto(out *ProvisioningRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProvisioningRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProvisioningRequestList. +func (in *ProvisioningRequestList) DeepCopy() *ProvisioningRequestList { + if in == nil { + return nil + } + out := new(ProvisioningRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProvisioningRequestList) 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 *ProvisioningRequestSpec) DeepCopyInto(out *ProvisioningRequestSpec) { + *out = *in + if in.PodSets != nil { + in, out := &in.PodSets, &out.PodSets + *out = make([]PodSet, len(*in)) + copy(*out, *in) + } + if in.Parameters != nil { + in, out := &in.Parameters, &out.Parameters + *out = make(map[string]Parameter, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProvisioningRequestSpec. +func (in *ProvisioningRequestSpec) DeepCopy() *ProvisioningRequestSpec { + if in == nil { + return nil + } + out := new(ProvisioningRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProvisioningRequestStatus) DeepCopyInto(out *ProvisioningRequestStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ProvisioningClassDetails != nil { + in, out := &in.ProvisioningClassDetails, &out.ProvisioningClassDetails + *out = make(map[string]Detail, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProvisioningRequestStatus. +func (in *ProvisioningRequestStatus) DeepCopy() *ProvisioningRequestStatus { + if in == nil { + return nil + } + out := new(ProvisioningRequestStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Reference) DeepCopyInto(out *Reference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reference. +func (in *Reference) DeepCopy() *Reference { + if in == nil { + return nil + } + out := new(Reference) + in.DeepCopyInto(out) + return out +} diff --git a/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/zz_generated.defaults.go b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/zz_generated.defaults.go new file mode 100644 index 000000000000..dac177e93bd0 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1/zz_generated.defaults.go @@ -0,0 +1,33 @@ +//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 defaulter-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// 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 +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/podset.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/podset.go new file mode 100644 index 000000000000..cd3a2a1bde1e --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/podset.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 v1 + +// PodSetApplyConfiguration represents a declarative configuration of the PodSet type for use +// with apply. +type PodSetApplyConfiguration struct { + PodTemplateRef *ReferenceApplyConfiguration `json:"podTemplateRef,omitempty"` + Count *int32 `json:"count,omitempty"` +} + +// PodSetApplyConfiguration constructs a declarative configuration of the PodSet type for use with +// apply. +func PodSet() *PodSetApplyConfiguration { + return &PodSetApplyConfiguration{} +} + +// WithPodTemplateRef sets the PodTemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodTemplateRef field is set to the value of the last call. +func (b *PodSetApplyConfiguration) WithPodTemplateRef(value *ReferenceApplyConfiguration) *PodSetApplyConfiguration { + b.PodTemplateRef = value + return b +} + +// WithCount sets the Count field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Count field is set to the value of the last call. +func (b *PodSetApplyConfiguration) WithCount(value int32) *PodSetApplyConfiguration { + b.Count = &value + return b +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequest.go new file mode 100644 index 000000000000..243d63d71256 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequest.go @@ -0,0 +1,225 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ProvisioningRequestApplyConfiguration represents a declarative configuration of the ProvisioningRequest type for use +// with apply. +type ProvisioningRequestApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ProvisioningRequestSpecApplyConfiguration `json:"spec,omitempty"` + Status *ProvisioningRequestStatusApplyConfiguration `json:"status,omitempty"` +} + +// ProvisioningRequest constructs a declarative configuration of the ProvisioningRequest type for use with +// apply. +func ProvisioningRequest(name, namespace string) *ProvisioningRequestApplyConfiguration { + b := &ProvisioningRequestApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ProvisioningRequest") + b.WithAPIVersion("autoscaling.x-k8s.io/v1") + 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 *ProvisioningRequestApplyConfiguration) WithKind(value string) *ProvisioningRequestApplyConfiguration { + b.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 *ProvisioningRequestApplyConfiguration) WithAPIVersion(value string) *ProvisioningRequestApplyConfiguration { + b.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 *ProvisioningRequestApplyConfiguration) WithName(value string) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithGenerateName(value string) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithNamespace(value string) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithUID(value types.UID) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithResourceVersion(value string) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithGeneration(value int64) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *ProvisioningRequestApplyConfiguration) WithLabels(entries map[string]string) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.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 *ProvisioningRequestApplyConfiguration) WithAnnotations(entries map[string]string) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.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 *ProvisioningRequestApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.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 *ProvisioningRequestApplyConfiguration) WithFinalizers(values ...string) *ProvisioningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ProvisioningRequestApplyConfiguration) 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 *ProvisioningRequestApplyConfiguration) WithSpec(value *ProvisioningRequestSpecApplyConfiguration) *ProvisioningRequestApplyConfiguration { + 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 *ProvisioningRequestApplyConfiguration) WithStatus(value *ProvisioningRequestStatusApplyConfiguration) *ProvisioningRequestApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ProvisioningRequestApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequestspec.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequestspec.go new file mode 100644 index 000000000000..e9a333d1431e --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequestspec.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 ( + autoscalingxk8siov1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" +) + +// ProvisioningRequestSpecApplyConfiguration represents a declarative configuration of the ProvisioningRequestSpec type for use +// with apply. +type ProvisioningRequestSpecApplyConfiguration struct { + PodSets []PodSetApplyConfiguration `json:"podSets,omitempty"` + ProvisioningClassName *string `json:"provisioningClassName,omitempty"` + Parameters map[string]autoscalingxk8siov1.Parameter `json:"parameters,omitempty"` +} + +// ProvisioningRequestSpecApplyConfiguration constructs a declarative configuration of the ProvisioningRequestSpec type for use with +// apply. +func ProvisioningRequestSpec() *ProvisioningRequestSpecApplyConfiguration { + return &ProvisioningRequestSpecApplyConfiguration{} +} + +// WithPodSets adds the given value to the PodSets 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 PodSets field. +func (b *ProvisioningRequestSpecApplyConfiguration) WithPodSets(values ...*PodSetApplyConfiguration) *ProvisioningRequestSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPodSets") + } + b.PodSets = append(b.PodSets, *values[i]) + } + return b +} + +// WithProvisioningClassName sets the ProvisioningClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProvisioningClassName field is set to the value of the last call. +func (b *ProvisioningRequestSpecApplyConfiguration) WithProvisioningClassName(value string) *ProvisioningRequestSpecApplyConfiguration { + b.ProvisioningClassName = &value + return b +} + +// WithParameters puts the entries into the Parameters 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 Parameters field, +// overwriting an existing map entries in Parameters field with the same key. +func (b *ProvisioningRequestSpecApplyConfiguration) WithParameters(entries map[string]autoscalingxk8siov1.Parameter) *ProvisioningRequestSpecApplyConfiguration { + if b.Parameters == nil && len(entries) > 0 { + b.Parameters = make(map[string]autoscalingxk8siov1.Parameter, len(entries)) + } + for k, v := range entries { + b.Parameters[k] = v + } + return b +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequeststatus.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequeststatus.go new file mode 100644 index 000000000000..3184761e17cd --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/provisioningrequeststatus.go @@ -0,0 +1,64 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 ( + autoscalingxk8siov1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ProvisioningRequestStatusApplyConfiguration represents a declarative configuration of the ProvisioningRequestStatus type for use +// with apply. +type ProvisioningRequestStatusApplyConfiguration struct { + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + ProvisioningClassDetails map[string]autoscalingxk8siov1.Detail `json:"provisioningClassDetails,omitempty"` +} + +// ProvisioningRequestStatusApplyConfiguration constructs a declarative configuration of the ProvisioningRequestStatus type for use with +// apply. +func ProvisioningRequestStatus() *ProvisioningRequestStatusApplyConfiguration { + return &ProvisioningRequestStatusApplyConfiguration{} +} + +// 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 *ProvisioningRequestStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ProvisioningRequestStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithProvisioningClassDetails puts the entries into the ProvisioningClassDetails 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 ProvisioningClassDetails field, +// overwriting an existing map entries in ProvisioningClassDetails field with the same key. +func (b *ProvisioningRequestStatusApplyConfiguration) WithProvisioningClassDetails(entries map[string]autoscalingxk8siov1.Detail) *ProvisioningRequestStatusApplyConfiguration { + if b.ProvisioningClassDetails == nil && len(entries) > 0 { + b.ProvisioningClassDetails = make(map[string]autoscalingxk8siov1.Detail, len(entries)) + } + for k, v := range entries { + b.ProvisioningClassDetails[k] = v + } + return b +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/reference.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/reference.go new file mode 100644 index 000000000000..904478c97a8b --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1/reference.go @@ -0,0 +1,39 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 + +// ReferenceApplyConfiguration represents a declarative configuration of the Reference type for use +// with apply. +type ReferenceApplyConfiguration struct { + Name *string `json:"name,omitempty"` +} + +// ReferenceApplyConfiguration constructs a declarative configuration of the Reference type for use with +// apply. +func Reference() *ReferenceApplyConfiguration { + return &ReferenceApplyConfiguration{} +} + +// 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 *ReferenceApplyConfiguration) WithName(value string) *ReferenceApplyConfiguration { + b.Name = &value + return b +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/utils.go b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/utils.go index 0b20db246cb1..391abd40c3d1 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/utils.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/utils.go @@ -21,7 +21,9 @@ package applyconfiguration import ( runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" v1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + autoscalingxk8siov1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1" autoscalingxk8siov1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1beta1" internal "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/internal" testing "k8s.io/client-go/testing" @@ -31,7 +33,19 @@ import ( // apply configuration type exists for the given GroupVersionKind. func ForKind(kind schema.GroupVersionKind) interface{} { switch kind { - // Group=autoscaling.x-k8s.io, Version=v1beta1 + // Group=autoscaling.x-k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithKind("PodSet"): + return &autoscalingxk8siov1.PodSetApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ProvisioningRequest"): + return &autoscalingxk8siov1.ProvisioningRequestApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ProvisioningRequestSpec"): + return &autoscalingxk8siov1.ProvisioningRequestSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ProvisioningRequestStatus"): + return &autoscalingxk8siov1.ProvisioningRequestStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("Reference"): + return &autoscalingxk8siov1.ReferenceApplyConfiguration{} + + // Group=autoscaling.x-k8s.io, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithKind("PodSet"): return &autoscalingxk8siov1beta1.PodSetApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("ProvisioningRequest"): diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/clientset.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/clientset.go index 2a940c1ac12d..26a7ccf023f2 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/clientset.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/clientset.go @@ -22,6 +22,7 @@ import ( "fmt" "net/http" + autoscalingv1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1" autoscalingv1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -30,15 +31,22 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + AutoscalingV1() autoscalingv1.AutoscalingV1Interface AutoscalingV1beta1() autoscalingv1beta1.AutoscalingV1beta1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient + autoscalingV1 *autoscalingv1.AutoscalingV1Client autoscalingV1beta1 *autoscalingv1beta1.AutoscalingV1beta1Client } +// AutoscalingV1 retrieves the AutoscalingV1Client +func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { + return c.autoscalingV1 +} + // AutoscalingV1beta1 retrieves the AutoscalingV1beta1Client func (c *Clientset) AutoscalingV1beta1() autoscalingv1beta1.AutoscalingV1beta1Interface { return c.autoscalingV1beta1 @@ -88,6 +96,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error + cs.autoscalingV1, err = autoscalingv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.autoscalingV1beta1, err = autoscalingv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -113,6 +125,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset + cs.autoscalingV1 = autoscalingv1.New(c) cs.autoscalingV1beta1 = autoscalingv1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/clientset_generated.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/clientset_generated.go index ca056dc72316..0f3714457977 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/clientset_generated.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/clientset_generated.go @@ -23,6 +23,8 @@ import ( "k8s.io/apimachinery/pkg/watch" applyconfiguration "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration" clientset "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned" + autoscalingv1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1" + fakeautoscalingv1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake" autoscalingv1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1" fakeautoscalingv1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1beta1/fake" "k8s.io/client-go/discovery" @@ -116,6 +118,11 @@ var ( _ testing.FakeClient = &Clientset{} ) +// AutoscalingV1 retrieves the AutoscalingV1Client +func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { + return &fakeautoscalingv1.FakeAutoscalingV1{Fake: &c.Fake} +} + // AutoscalingV1beta1 retrieves the AutoscalingV1beta1Client func (c *Clientset) AutoscalingV1beta1() autoscalingv1beta1.AutoscalingV1beta1Interface { return &fakeautoscalingv1beta1.FakeAutoscalingV1beta1{Fake: &c.Fake} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/register.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/register.go index 63b931ff9509..4d8dd7d66976 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/register.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake/register.go @@ -24,6 +24,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + autoscalingv1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" autoscalingv1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" ) @@ -31,6 +32,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + autoscalingv1.AddToScheme, autoscalingv1beta1.AddToScheme, } diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/scheme/register.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/scheme/register.go index ee8998ec2364..7620e5a31ddf 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/scheme/register.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/scheme/register.go @@ -24,6 +24,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + autoscalingv1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" autoscalingv1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" ) @@ -31,6 +32,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + autoscalingv1.AddToScheme, autoscalingv1beta1.AddToScheme, } diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/autoscaling.x-k8s.io_client.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/autoscaling.x-k8s.io_client.go new file mode 100644 index 000000000000..bc5907b6a507 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/autoscaling.x-k8s.io_client.go @@ -0,0 +1,107 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 ( + "net/http" + + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type AutoscalingV1Interface interface { + RESTClient() rest.Interface + ProvisioningRequestsGetter +} + +// AutoscalingV1Client is used to interact with features provided by the autoscaling.x-k8s.io group. +type AutoscalingV1Client struct { + restClient rest.Interface +} + +func (c *AutoscalingV1Client) ProvisioningRequests(namespace string) ProvisioningRequestInterface { + return newProvisioningRequests(c, namespace) +} + +// NewForConfig creates a new AutoscalingV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AutoscalingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AutoscalingV1Client 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) (*AutoscalingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AutoscalingV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AutoscalingV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AutoscalingV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AutoscalingV1Client for the given RESTClient. +func New(c rest.Interface) *AutoscalingV1Client { + return &AutoscalingV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AutoscalingV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/doc.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/doc.go new file mode 100644 index 000000000000..3af5d054f102 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/doc.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/doc.go new file mode 100644 index 000000000000..16f44399065e --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/fake_autoscaling.x-k8s.io_client.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/fake_autoscaling.x-k8s.io_client.go new file mode 100644 index 000000000000..5f273be785cc --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/fake_autoscaling.x-k8s.io_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAutoscalingV1 struct { + *testing.Fake +} + +func (c *FakeAutoscalingV1) ProvisioningRequests(namespace string) v1.ProvisioningRequestInterface { + return &FakeProvisioningRequests{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAutoscalingV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/fake_provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/fake_provisioningrequest.go new file mode 100644 index 000000000000..d42842aba7f8 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/fake/fake_provisioningrequest.go @@ -0,0 +1,197 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 ( + "context" + json "encoding/json" + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" + autoscalingxk8siov1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1" + testing "k8s.io/client-go/testing" +) + +// FakeProvisioningRequests implements ProvisioningRequestInterface +type FakeProvisioningRequests struct { + Fake *FakeAutoscalingV1 + ns string +} + +var provisioningrequestsResource = v1.SchemeGroupVersion.WithResource("provisioningrequests") + +var provisioningrequestsKind = v1.SchemeGroupVersion.WithKind("ProvisioningRequest") + +// Get takes name of the provisioningRequest, and returns the corresponding provisioningRequest object, and an error if there is any. +func (c *FakeProvisioningRequests) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ProvisioningRequest, err error) { + emptyResult := &v1.ProvisioningRequest{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(provisioningrequestsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1.ProvisioningRequest), err +} + +// List takes label and field selectors, and returns the list of ProvisioningRequests that match those selectors. +func (c *FakeProvisioningRequests) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ProvisioningRequestList, err error) { + emptyResult := &v1.ProvisioningRequestList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(provisioningrequestsResource, provisioningrequestsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ProvisioningRequestList{ListMeta: obj.(*v1.ProvisioningRequestList).ListMeta} + for _, item := range obj.(*v1.ProvisioningRequestList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested provisioningRequests. +func (c *FakeProvisioningRequests) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(provisioningrequestsResource, c.ns, opts)) + +} + +// Create takes the representation of a provisioningRequest and creates it. Returns the server's representation of the provisioningRequest, and an error, if there is any. +func (c *FakeProvisioningRequests) Create(ctx context.Context, provisioningRequest *v1.ProvisioningRequest, opts metav1.CreateOptions) (result *v1.ProvisioningRequest, err error) { + emptyResult := &v1.ProvisioningRequest{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(provisioningrequestsResource, c.ns, provisioningRequest, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1.ProvisioningRequest), err +} + +// Update takes the representation of a provisioningRequest and updates it. Returns the server's representation of the provisioningRequest, and an error, if there is any. +func (c *FakeProvisioningRequests) Update(ctx context.Context, provisioningRequest *v1.ProvisioningRequest, opts metav1.UpdateOptions) (result *v1.ProvisioningRequest, err error) { + emptyResult := &v1.ProvisioningRequest{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(provisioningrequestsResource, c.ns, provisioningRequest, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1.ProvisioningRequest), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeProvisioningRequests) UpdateStatus(ctx context.Context, provisioningRequest *v1.ProvisioningRequest, opts metav1.UpdateOptions) (result *v1.ProvisioningRequest, err error) { + emptyResult := &v1.ProvisioningRequest{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(provisioningrequestsResource, "status", c.ns, provisioningRequest, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1.ProvisioningRequest), err +} + +// Delete takes name of the provisioningRequest and deletes it. Returns an error if one occurs. +func (c *FakeProvisioningRequests) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(provisioningrequestsResource, c.ns, name, opts), &v1.ProvisioningRequest{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeProvisioningRequests) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(provisioningrequestsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ProvisioningRequestList{}) + return err +} + +// Patch applies the patch and returns the patched provisioningRequest. +func (c *FakeProvisioningRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ProvisioningRequest, err error) { + emptyResult := &v1.ProvisioningRequest{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(provisioningrequestsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1.ProvisioningRequest), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied provisioningRequest. +func (c *FakeProvisioningRequests) Apply(ctx context.Context, provisioningRequest *autoscalingxk8siov1.ProvisioningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ProvisioningRequest, err error) { + if provisioningRequest == nil { + return nil, fmt.Errorf("provisioningRequest provided to Apply must not be nil") + } + data, err := json.Marshal(provisioningRequest) + if err != nil { + return nil, err + } + name := provisioningRequest.Name + if name == nil { + return nil, fmt.Errorf("provisioningRequest.Name must be provided to Apply") + } + emptyResult := &v1.ProvisioningRequest{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(provisioningrequestsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1.ProvisioningRequest), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeProvisioningRequests) ApplyStatus(ctx context.Context, provisioningRequest *autoscalingxk8siov1.ProvisioningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ProvisioningRequest, err error) { + if provisioningRequest == nil { + return nil, fmt.Errorf("provisioningRequest provided to Apply must not be nil") + } + data, err := json.Marshal(provisioningRequest) + if err != nil { + return nil, err + } + name := provisioningRequest.Name + if name == nil { + return nil, fmt.Errorf("provisioningRequest.Name must be provided to Apply") + } + emptyResult := &v1.ProvisioningRequest{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(provisioningrequestsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1.ProvisioningRequest), err +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/generated_expansion.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/generated_expansion.go new file mode 100644 index 000000000000..01f1ec281172 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/generated_expansion.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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type ProvisioningRequestExpansion interface{} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/provisioningrequest.go new file mode 100644 index 000000000000..94c64babfe67 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/typed/autoscaling.x-k8s.io/v1/provisioningrequest.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 client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" + autoscalingxk8siov1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/applyconfiguration/autoscaling.x-k8s.io/v1" + scheme "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/scheme" + gentype "k8s.io/client-go/gentype" +) + +// ProvisioningRequestsGetter has a method to return a ProvisioningRequestInterface. +// A group's client should implement this interface. +type ProvisioningRequestsGetter interface { + ProvisioningRequests(namespace string) ProvisioningRequestInterface +} + +// ProvisioningRequestInterface has methods to work with ProvisioningRequest resources. +type ProvisioningRequestInterface interface { + Create(ctx context.Context, provisioningRequest *v1.ProvisioningRequest, opts metav1.CreateOptions) (*v1.ProvisioningRequest, error) + Update(ctx context.Context, provisioningRequest *v1.ProvisioningRequest, opts metav1.UpdateOptions) (*v1.ProvisioningRequest, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, provisioningRequest *v1.ProvisioningRequest, opts metav1.UpdateOptions) (*v1.ProvisioningRequest, 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) (*v1.ProvisioningRequest, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ProvisioningRequestList, 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 *v1.ProvisioningRequest, err error) + Apply(ctx context.Context, provisioningRequest *autoscalingxk8siov1.ProvisioningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ProvisioningRequest, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, provisioningRequest *autoscalingxk8siov1.ProvisioningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ProvisioningRequest, err error) + ProvisioningRequestExpansion +} + +// provisioningRequests implements ProvisioningRequestInterface +type provisioningRequests struct { + *gentype.ClientWithListAndApply[*v1.ProvisioningRequest, *v1.ProvisioningRequestList, *autoscalingxk8siov1.ProvisioningRequestApplyConfiguration] +} + +// newProvisioningRequests returns a ProvisioningRequests +func newProvisioningRequests(c *AutoscalingV1Client, namespace string) *provisioningRequests { + return &provisioningRequests{ + gentype.NewClientWithListAndApply[*v1.ProvisioningRequest, *v1.ProvisioningRequestList, *autoscalingxk8siov1.ProvisioningRequestApplyConfiguration]( + "provisioningrequests", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.ProvisioningRequest { return &v1.ProvisioningRequest{} }, + func() *v1.ProvisioningRequestList { return &v1.ProvisioningRequestList{} }), + } +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/interface.go b/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/interface.go index ff99b5a2d9db..ff9a014c2a14 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/interface.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/interface.go @@ -19,12 +19,15 @@ limitations under the License. package autoscaling import ( + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1" v1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1beta1" internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/internalinterfaces" ) // Interface provides access to each of this group's versions. type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } @@ -40,6 +43,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1/interface.go b/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1/interface.go new file mode 100644 index 000000000000..b2bec8f33553 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1/interface.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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ProvisioningRequests returns a ProvisioningRequestInformer. + ProvisioningRequests() ProvisioningRequestInformer +} + +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} +} + +// ProvisioningRequests returns a ProvisioningRequestInformer. +func (v *version) ProvisioningRequests() ProvisioningRequestInformer { + return &provisioningRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1/provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1/provisioningrequest.go new file mode 100644 index 000000000000..4baa6180f1c5 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/autoscaling.x-k8s.io/v1/provisioningrequest.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + autoscalingxk8siov1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" + versioned "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/internalinterfaces" + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ProvisioningRequestInformer provides access to a shared informer and lister for +// ProvisioningRequests. +type ProvisioningRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ProvisioningRequestLister +} + +type provisioningRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewProvisioningRequestInformer constructs a new informer for ProvisioningRequest 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 NewProvisioningRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredProvisioningRequestInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredProvisioningRequestInformer constructs a new informer for ProvisioningRequest 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 NewFilteredProvisioningRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().ProvisioningRequests(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().ProvisioningRequests(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingxk8siov1.ProvisioningRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *provisioningRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredProvisioningRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *provisioningRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingxk8siov1.ProvisioningRequest{}, f.defaultInformer) +} + +func (f *provisioningRequestInformer) Lister() v1.ProvisioningRequestLister { + return v1.NewProvisioningRequestLister(f.Informer().GetIndexer()) +} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/generic.go b/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/generic.go index 94ac828160a2..7125708cce36 100644 --- a/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/generic.go +++ b/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions/generic.go @@ -22,6 +22,7 @@ import ( "fmt" schema "k8s.io/apimachinery/pkg/runtime/schema" + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" v1beta1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" cache "k8s.io/client-go/tools/cache" ) @@ -52,7 +53,11 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=autoscaling.x-k8s.io, Version=v1beta1 + // Group=autoscaling.x-k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("provisioningrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1().ProvisioningRequests().Informer()}, nil + + // Group=autoscaling.x-k8s.io, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithResource("provisioningrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1beta1().ProvisioningRequests().Informer()}, nil diff --git a/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1/expansion_generated.go b/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1/expansion_generated.go new file mode 100644 index 000000000000..7d4964dcc395 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT 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 + +// ProvisioningRequestListerExpansion allows custom methods to be added to +// ProvisioningRequestLister. +type ProvisioningRequestListerExpansion interface{} + +// ProvisioningRequestNamespaceListerExpansion allows custom methods to be added to +// ProvisioningRequestNamespaceLister. +type ProvisioningRequestNamespaceListerExpansion interface{} diff --git a/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1/provisioningrequest.go b/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1/provisioningrequest.go new file mode 100644 index 000000000000..b447a56eac12 --- /dev/null +++ b/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1/provisioningrequest.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 v1 + +import ( + "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// ProvisioningRequestLister helps list ProvisioningRequests. +// All objects returned here must be treated as read-only. +type ProvisioningRequestLister interface { + // List lists all ProvisioningRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ProvisioningRequest, err error) + // ProvisioningRequests returns an object that can list and get ProvisioningRequests. + ProvisioningRequests(namespace string) ProvisioningRequestNamespaceLister + ProvisioningRequestListerExpansion +} + +// provisioningRequestLister implements the ProvisioningRequestLister interface. +type provisioningRequestLister struct { + listers.ResourceIndexer[*v1.ProvisioningRequest] +} + +// NewProvisioningRequestLister returns a new ProvisioningRequestLister. +func NewProvisioningRequestLister(indexer cache.Indexer) ProvisioningRequestLister { + return &provisioningRequestLister{listers.New[*v1.ProvisioningRequest](indexer, v1.Resource("provisioningrequest"))} +} + +// ProvisioningRequests returns an object that can list and get ProvisioningRequests. +func (s *provisioningRequestLister) ProvisioningRequests(namespace string) ProvisioningRequestNamespaceLister { + return provisioningRequestNamespaceLister{listers.NewNamespaced[*v1.ProvisioningRequest](s.ResourceIndexer, namespace)} +} + +// ProvisioningRequestNamespaceLister helps list and get ProvisioningRequests. +// All objects returned here must be treated as read-only. +type ProvisioningRequestNamespaceLister interface { + // List lists all ProvisioningRequests in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ProvisioningRequest, err error) + // Get retrieves the ProvisioningRequest from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ProvisioningRequest, error) + ProvisioningRequestNamespaceListerExpansion +} + +// provisioningRequestNamespaceLister implements the ProvisioningRequestNamespaceLister +// interface. +type provisioningRequestNamespaceLister struct { + listers.ResourceIndexer[*v1.ProvisioningRequest] +} From 524bbfd1d0f84d081310b47cad8bf575607291cf Mon Sep 17 00:00:00 2001 From: Aleksandra Malinowska Date: Wed, 21 Aug 2024 18:18:55 +0200 Subject: [PATCH 6/7] Revert "Temporarily make cluster-autoscaler/apis a package in" This reverts commit 850bd64b04c2134b5b5c4598db0d6d8a92bbc276. --- cluster-autoscaler/apis/go.mod | 60 ++++++++++++ cluster-autoscaler/apis/go.sum | 164 +++++++++++++++++++++++++++++++++ cluster-autoscaler/go.mod | 11 ++- 3 files changed, 231 insertions(+), 4 deletions(-) create mode 100644 cluster-autoscaler/apis/go.mod create mode 100644 cluster-autoscaler/apis/go.sum diff --git a/cluster-autoscaler/apis/go.mod b/cluster-autoscaler/apis/go.mod new file mode 100644 index 000000000000..14f2b5e9012c --- /dev/null +++ b/cluster-autoscaler/apis/go.mod @@ -0,0 +1,60 @@ +module k8s.io/autoscaler/cluster-autoscaler/apis + +go 1.22.0 + +require ( + github.com/onsi/ginkgo/v2 v2.19.0 + github.com/onsi/gomega v1.33.1 + k8s.io/apimachinery v0.31.0-alpha.2 + k8s.io/client-go v0.31.0-alpha.2 + k8s.io/code-generator v0.31.0-alpha.2 + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 +) + +require ( + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0-beta // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/x448/float16 v0.8.4 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/oauth2 v0.20.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/term v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.21.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/api v0.31.0-alpha.2 // indirect + k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect + k8s.io/klog/v2 v2.120.1 // indirect + k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/yaml v1.4.0 // indirect +) diff --git a/cluster-autoscaler/apis/go.sum b/cluster-autoscaler/apis/go.sum new file mode 100644 index 000000000000..ca3f084137b8 --- /dev/null +++ b/cluster-autoscaler/apis/go.sum @@ -0,0 +1,164 @@ +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +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= +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.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/fxamacker/cbor/v2 v2.7.0-beta h1:m5bO941uTVpSms26QjzEJxUZaC3S/h1pSJexBCu4wAA= +github.com/fxamacker/cbor/v2 v2.7.0-beta/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +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/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +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= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/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.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +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= +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= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= +golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +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.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= +golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +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= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +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= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +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.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +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/api v0.31.0-alpha.2 h1:azMbpAFERqtGmgDtg/f7efnxgPBW+8ieyHNKxT97EMI= +k8s.io/api v0.31.0-alpha.2/go.mod h1:S1X5UjUV8NZmR1vmKIkUpruhr0AWAvocZVZ5zxKMvi4= +k8s.io/apimachinery v0.31.0-alpha.2 h1:jya7Ax6yRLH+CSW/osUEO+hxe4rVNrXU8lNB0fZcGkk= +k8s.io/apimachinery v0.31.0-alpha.2/go.mod h1:3nAExNh3CrzC6eKT9a32j/rv+uJ8Zod87oOmgUjZNAY= +k8s.io/client-go v0.31.0-alpha.2 h1:13UCBphjOLcqQ1ROBA+y9sr9Bmc/Ss1ypHQEDb6uKas= +k8s.io/client-go v0.31.0-alpha.2/go.mod h1:wF4N5QBYqOoXntvUsYd5eyfDLqskc/UNDyEF6WvaFIk= +k8s.io/code-generator v0.31.0-alpha.2 h1:ZgL/AgAXFbZ4P32Rrv2FFxQPU2MKTdNd4RTVAipCQlE= +k8s.io/code-generator v0.31.0-alpha.2/go.mod h1:4hS5z9BqvAr5Lup7NsSAh2iXug1I6KVB5x9bnQD1w8k= +k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= +k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/cluster-autoscaler/go.mod b/cluster-autoscaler/go.mod index 120afa9adb59..7341cbd08217 100644 --- a/cluster-autoscaler/go.mod +++ b/cluster-autoscaler/go.mod @@ -28,8 +28,6 @@ require ( github.com/jmattheis/goverter v1.4.0 github.com/jmespath/go-jmespath v0.4.0 github.com/json-iterator/go v1.1.12 - github.com/onsi/ginkgo/v2 v2.19.0 - github.com/onsi/gomega v1.33.1 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.19.1 github.com/spf13/pflag v1.0.5 @@ -47,11 +45,11 @@ require ( k8s.io/api v0.31.0-beta.0 k8s.io/apimachinery v0.31.0-beta.0 k8s.io/apiserver v0.31.0-beta.0 + k8s.io/autoscaler/cluster-autoscaler/apis v0.0.0-20240627115740-d52e4b9665d7 k8s.io/client-go v0.31.0-beta.0 k8s.io/cloud-provider v0.30.0-alpha.3 k8s.io/cloud-provider-aws v1.27.0 k8s.io/cloud-provider-gcp/providers v0.28.2 - k8s.io/code-generator v0.31.0-beta.0 k8s.io/component-base v0.31.0-beta.0 k8s.io/component-helpers v0.31.0-beta.0 k8s.io/klog/v2 v2.130.1 @@ -59,7 +57,6 @@ require ( k8s.io/kubernetes v1.31.0-beta.0 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 sigs.k8s.io/cloud-provider-azure v1.29.4 - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 sigs.k8s.io/yaml v1.4.0 ) @@ -154,6 +151,8 @@ require ( github.com/mrunalp/fileutils v0.5.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect + github.com/onsi/ginkgo/v2 v2.19.0 // indirect + github.com/onsi/gomega v1.33.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/runc v1.1.13 // indirect github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78 // indirect @@ -204,6 +203,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.0.0 // indirect + k8s.io/code-generator v0.31.0-beta.0 // indirect k8s.io/controller-manager v0.31.0-beta.0 // indirect k8s.io/cri-api v0.31.0-beta.0 // indirect k8s.io/cri-client v0.0.0 // indirect @@ -219,6 +219,7 @@ require ( sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.13 // indirect sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.4 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) replace github.com/aws/aws-sdk-go/service/eks => github.com/aws/aws-sdk-go/service/eks v1.38.49 @@ -285,4 +286,6 @@ replace k8s.io/kms => k8s.io/kms v0.31.0-beta.0 replace k8s.io/endpointslice => k8s.io/endpointslice v0.31.0-beta.0 +replace k8s.io/autoscaler/cluster-autoscaler/apis => ./apis + replace k8s.io/cri-client => k8s.io/cri-client v0.31.0-beta.0 From 10650dc8bf4f1147ea74a6dce2d6bf01046a9ece Mon Sep 17 00:00:00 2001 From: Aleksandra Malinowska Date: Wed, 21 Aug 2024 18:21:46 +0200 Subject: [PATCH 7/7] Use ProvisioningRequest v1 client in code --- .../processors/provreq/injector.go | 10 +- .../processors/provreq/injector_test.go | 34 ++-- .../processors/provreq/pods_filter.go | 8 +- .../processors/provreq/pods_filter_test.go | 30 +-- .../processors/provreq/processor.go | 12 +- .../processors/provreq/processor_test.go | 46 ++--- .../besteffortatomic/provisioning_class.go | 12 +- .../checkcapacity/provisioningclass.go | 8 +- .../conditions/condition_test.go | 176 +++++++++--------- .../conditions/conditions.go | 8 +- .../orchestrator/orchestrator_test.go | 30 +-- .../orchestrator/wrapper_orchestrator.go | 4 +- .../orchestrator/wrapper_orchestrator_test.go | 4 +- .../provisioningrequest/pods/pods.go | 18 +- .../provisioningrequest/pods/pods_test.go | 150 +++++++-------- .../provreqclient/client.go | 44 ++--- .../provreqclient/client_test.go | 4 +- .../provreqclient/testutils.go | 28 +-- .../provreqwrapper/testutils.go | 17 +- .../provreqwrapper/wrapper.go | 10 +- .../provreqwrapper/wrapper_test.go | 20 +- .../provisioningrequest/supported_classes.go | 6 +- 22 files changed, 339 insertions(+), 340 deletions(-) diff --git a/cluster-autoscaler/processors/provreq/injector.go b/cluster-autoscaler/processors/provreq/injector.go index 9ac7855a5822..c628fedf1252 100644 --- a/cluster-autoscaler/processors/provreq/injector.go +++ b/cluster-autoscaler/processors/provreq/injector.go @@ -22,7 +22,7 @@ import ( apiv1 "k8s.io/api/core/v1" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/processors/pods" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest" @@ -59,11 +59,11 @@ func (p *ProvisioningRequestPodsInjector) Process( continue } conditions := pr.Status.Conditions - if apimeta.IsStatusConditionTrue(conditions, v1beta1.Failed) || apimeta.IsStatusConditionTrue(conditions, v1beta1.Provisioned) { + if apimeta.IsStatusConditionTrue(conditions, v1.Failed) || apimeta.IsStatusConditionTrue(conditions, v1.Provisioned) { continue } - provisioned := apimeta.FindStatusCondition(conditions, v1beta1.Provisioned) + provisioned := apimeta.FindStatusCondition(conditions, v1.Provisioned) //TODO(yaroslava): support exponential backoff // Inject pods if ProvReq wasn't scaled up before or it has Provisioned == False condition more than defaultRetryTime @@ -79,13 +79,13 @@ func (p *ProvisioningRequestPodsInjector) Process( provreqpods, err := provreqpods.PodsForProvisioningRequest(pr) if err != nil { klog.Errorf("Failed to get pods for ProvisioningRequest %v", pr.Name) - provreqconditions.AddOrUpdateCondition(pr, v1beta1.Failed, metav1.ConditionTrue, provreqconditions.FailedToCreatePodsReason, err.Error(), metav1.NewTime(p.clock.Now())) + provreqconditions.AddOrUpdateCondition(pr, v1.Failed, metav1.ConditionTrue, provreqconditions.FailedToCreatePodsReason, err.Error(), metav1.NewTime(p.clock.Now())) if _, err := p.client.UpdateProvisioningRequest(pr.ProvisioningRequest); err != nil { klog.Errorf("failed add Failed condition to ProvReq %s/%s, err: %v", pr.Namespace, pr.Name, err) } continue } - provreqconditions.AddOrUpdateCondition(pr, v1beta1.Accepted, metav1.ConditionTrue, provreqconditions.AcceptedReason, provreqconditions.AcceptedMsg, metav1.NewTime(p.clock.Now())) + provreqconditions.AddOrUpdateCondition(pr, v1.Accepted, metav1.ConditionTrue, provreqconditions.AcceptedReason, provreqconditions.AcceptedMsg, metav1.NewTime(p.clock.Now())) if _, err := p.client.UpdateProvisioningRequest(pr.ProvisioningRequest); err != nil { klog.Errorf("failed add Accepted condition to ProvReq %s/%s, err: %v", pr.Namespace, pr.Name, err) continue diff --git a/cluster-autoscaler/processors/provreq/injector_test.go b/cluster-autoscaler/processors/provreq/injector_test.go index 625b0a7be571..804aaf782c9c 100644 --- a/cluster-autoscaler/processors/provreq/injector_test.go +++ b/cluster-autoscaler/processors/provreq/injector_test.go @@ -21,10 +21,10 @@ import ( "testing" "time" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqclient" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqwrapper" clock "k8s.io/utils/clock/testing" @@ -36,46 +36,46 @@ func TestProvisioningRequestPodsInjector(t *testing.T) { hourAgo := now.Add(-1 * time.Hour) accepted := metav1.Condition{ - Type: v1beta1.Accepted, + Type: v1.Accepted, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(minAgo), } failed := metav1.Condition{ - Type: v1beta1.Failed, + Type: v1.Failed, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(hourAgo), } provisioned := metav1.Condition{ - Type: v1beta1.Provisioned, + Type: v1.Provisioned, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(hourAgo), } notProvisioned := metav1.Condition{ - Type: v1beta1.Provisioned, + Type: v1.Provisioned, Status: metav1.ConditionFalse, LastTransitionTime: metav1.NewTime(hourAgo), } unknownProvisioned := metav1.Condition{ - Type: v1beta1.Provisioned, + Type: v1.Provisioned, Status: metav1.ConditionUnknown, LastTransitionTime: metav1.NewTime(hourAgo), } notProvisionedRecently := metav1.Condition{ - Type: v1beta1.Provisioned, + Type: v1.Provisioned, Status: metav1.ConditionFalse, LastTransitionTime: metav1.NewTime(minAgo), } podsA := 10 - newProvReqA := testProvisioningRequestWithCondition("new", podsA, v1beta1.ProvisioningClassCheckCapacity) - newAcceptedProvReqA := testProvisioningRequestWithCondition("new-accepted", podsA, v1beta1.ProvisioningClassCheckCapacity, accepted) + newProvReqA := testProvisioningRequestWithCondition("new", podsA, v1.ProvisioningClassCheckCapacity) + newAcceptedProvReqA := testProvisioningRequestWithCondition("new-accepted", podsA, v1.ProvisioningClassCheckCapacity, accepted) podsB := 20 - notProvisionedAcceptedProvReqB := testProvisioningRequestWithCondition("provisioned-false-B", podsB, v1beta1.ProvisioningClassBestEffortAtomicScaleUp, notProvisioned, accepted) - provisionedAcceptedProvReqB := testProvisioningRequestWithCondition("provisioned-and-accepted", podsB, v1beta1.ProvisioningClassBestEffortAtomicScaleUp, provisioned, accepted) - failedProvReq := testProvisioningRequestWithCondition("failed", podsA, v1beta1.ProvisioningClassBestEffortAtomicScaleUp, failed) - notProvisionedRecentlyProvReqB := testProvisioningRequestWithCondition("provisioned-false-recently-B", podsB, v1beta1.ProvisioningClassBestEffortAtomicScaleUp, notProvisionedRecently) - unknownProvisionedProvReqB := testProvisioningRequestWithCondition("provisioned-unknown-B", podsB, v1beta1.ProvisioningClassBestEffortAtomicScaleUp, unknownProvisioned) + notProvisionedAcceptedProvReqB := testProvisioningRequestWithCondition("provisioned-false-B", podsB, v1.ProvisioningClassBestEffortAtomicScaleUp, notProvisioned, accepted) + provisionedAcceptedProvReqB := testProvisioningRequestWithCondition("provisioned-and-accepted", podsB, v1.ProvisioningClassBestEffortAtomicScaleUp, provisioned, accepted) + failedProvReq := testProvisioningRequestWithCondition("failed", podsA, v1.ProvisioningClassBestEffortAtomicScaleUp, failed) + notProvisionedRecentlyProvReqB := testProvisioningRequestWithCondition("provisioned-false-recently-B", podsB, v1.ProvisioningClassBestEffortAtomicScaleUp, notProvisionedRecently) + unknownProvisionedProvReqB := testProvisioningRequestWithCondition("provisioned-unknown-B", podsB, v1.ProvisioningClassBestEffortAtomicScaleUp, unknownProvisioned) unknownClass := testProvisioningRequestWithCondition("new-accepted", podsA, "unknown-class", accepted) testCases := []struct { @@ -118,7 +118,7 @@ func TestProvisioningRequestPodsInjector(t *testing.T) { for _, tc := range testCases { client := provreqclient.NewFakeProvisioningRequestClient(context.Background(), t, tc.provReqs...) injector := ProvisioningRequestPodsInjector{client, clock.NewFakePassiveClock(now)} - getUnscheduledPods, err := injector.Process(nil, []*v1.Pod{}) + getUnscheduledPods, err := injector.Process(nil, []*corev1.Pod{}) if err != nil { t.Errorf("%s failed: injector.Process return error %v", tc.name, err) } @@ -129,7 +129,7 @@ func TestProvisioningRequestPodsInjector(t *testing.T) { continue } pr, _ := client.ProvisioningRequestNoCache("ns", tc.wantUpdatedConditionName) - accepted := apimeta.FindStatusCondition(pr.Status.Conditions, v1beta1.Accepted) + accepted := apimeta.FindStatusCondition(pr.Status.Conditions, v1.Accepted) if accepted == nil || accepted.LastTransitionTime != metav1.NewTime(now) { t.Errorf("%s: injector.Process hasn't update accepted condition for ProvisioningRequest %s", tc.name, tc.wantUpdatedConditionName) } diff --git a/cluster-autoscaler/processors/provreq/pods_filter.go b/cluster-autoscaler/processors/provreq/pods_filter.go index fb61ce25f3f7..a2d0d4a3d664 100644 --- a/cluster-autoscaler/processors/provreq/pods_filter.go +++ b/cluster-autoscaler/processors/provreq/pods_filter.go @@ -21,8 +21,8 @@ import ( "time" apiv1 "k8s.io/api/core/v1" - v1 "k8s.io/api/core/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + corev1 "k8s.io/api/core/v1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/processors/pods" provreqpods "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/pods" @@ -96,11 +96,11 @@ func NewProvisioningRequestPodsFilter(e EventManager) pods.PodListProcessor { return &ProvisioningRequestPodsFilter{e} } -func provisioningRequestName(pod *v1.Pod) (string, bool) { +func provisioningRequestName(pod *corev1.Pod) (string, bool) { if pod == nil || pod.Annotations == nil { return "", false } - provReqName, found := pod.Annotations[v1beta1.ProvisioningRequestPodAnnotationKey] + provReqName, found := pod.Annotations[v1.ProvisioningRequestPodAnnotationKey] if !found { provReqName, found = pod.Annotations[provreqpods.DeprecatedProvisioningRequestPodAnnotationKey] } diff --git a/cluster-autoscaler/processors/provreq/pods_filter_test.go b/cluster-autoscaler/processors/provreq/pods_filter_test.go index 80977fcdd30c..da041fb5ed20 100644 --- a/cluster-autoscaler/processors/provreq/pods_filter_test.go +++ b/cluster-autoscaler/processors/provreq/pods_filter_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/assert" apiv1 "k8s.io/api/core/v1" - v1 "k8s.io/api/core/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + corev1 "k8s.io/api/core/v1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/pods" . "k8s.io/autoscaler/cluster-autoscaler/utils/test" @@ -33,7 +33,7 @@ import ( func TestProvisioningRequestPodsFilter(t *testing.T) { prPod1 := BuildTestPod("pr-pod-1", 500, 10) - prPod1.Annotations[v1beta1.ProvisioningRequestPodAnnotationKey] = "pr-class" + prPod1.Annotations[v1.ProvisioningRequestPodAnnotationKey] = "pr-class" prPod2 := BuildTestPod("pr-pod-2", 500, 10) prPod2.Annotations[pods.DeprecatedProvisioningRequestPodAnnotationKey] = "pr-class-2" @@ -46,24 +46,24 @@ func TestProvisioningRequestPodsFilter(t *testing.T) { expectedUnscheduledPods []*apiv1.Pod }{ "ProvisioningRequest consumer is filtered out": { - unschedulableCandidates: []*v1.Pod{prPod1, pod1}, - expectedUnscheduledPods: []*v1.Pod{pod1}, + unschedulableCandidates: []*corev1.Pod{prPod1, pod1}, + expectedUnscheduledPods: []*corev1.Pod{pod1}, }, "Different ProvisioningRequest consumers are filtered out": { - unschedulableCandidates: []*v1.Pod{prPod1, prPod2, pod1}, - expectedUnscheduledPods: []*v1.Pod{pod1}, + unschedulableCandidates: []*corev1.Pod{prPod1, prPod2, pod1}, + expectedUnscheduledPods: []*corev1.Pod{pod1}, }, "No pod is filtered": { - unschedulableCandidates: []*v1.Pod{pod1, pod2}, - expectedUnscheduledPods: []*v1.Pod{pod1, pod2}, + unschedulableCandidates: []*corev1.Pod{pod1, pod2}, + expectedUnscheduledPods: []*corev1.Pod{pod1, pod2}, }, "Empty unschedulable pods list": { - unschedulableCandidates: []*v1.Pod{}, - expectedUnscheduledPods: []*v1.Pod{}, + unschedulableCandidates: []*corev1.Pod{}, + expectedUnscheduledPods: []*corev1.Pod{}, }, "All ProvisioningRequest consumers are filtered out": { - unschedulableCandidates: []*v1.Pod{prPod1, prPod2}, - expectedUnscheduledPods: []*v1.Pod{}, + unschedulableCandidates: []*corev1.Pod{prPod1, prPod2}, + expectedUnscheduledPods: []*corev1.Pod{}, }, } for _, test := range testCases { @@ -89,11 +89,11 @@ func TestEventManager(t *testing.T) { prFilter := NewProvisioningRequestPodsFilter(eventManager) eventRecorder := record.NewFakeRecorder(10) ctx := &context.AutoscalingContext{AutoscalingKubeClients: context.AutoscalingKubeClients{Recorder: eventRecorder}} - unscheduledPods := []*v1.Pod{BuildTestPod("pod", 500, 10)} + unscheduledPods := []*corev1.Pod{BuildTestPod("pod", 500, 10)} for i := 0; i < 10; i++ { prPod := BuildTestPod(fmt.Sprintf("pr-pod-%d", i), 10, 10) - prPod.Annotations[v1beta1.ProvisioningRequestPodAnnotationKey] = "pr-class" + prPod.Annotations[v1.ProvisioningRequestPodAnnotationKey] = "pr-class" unscheduledPods = append(unscheduledPods, prPod) } got, err := prFilter.Process(ctx, unscheduledPods) diff --git a/cluster-autoscaler/processors/provreq/processor.go b/cluster-autoscaler/processors/provreq/processor.go index 3708366d2dda..a08af27f8a03 100644 --- a/cluster-autoscaler/processors/provreq/processor.go +++ b/cluster-autoscaler/processors/provreq/processor.go @@ -23,7 +23,7 @@ import ( apiv1 "k8s.io/api/core/v1" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/conditions" @@ -87,10 +87,10 @@ func (p *provReqProcessor) refresh(provReqs []*provreqwrapper.ProvisioningReques continue } conditions := provReq.Status.Conditions - if apimeta.IsStatusConditionTrue(conditions, v1beta1.BookingExpired) || apimeta.IsStatusConditionTrue(conditions, v1beta1.Failed) { + if apimeta.IsStatusConditionTrue(conditions, v1.BookingExpired) || apimeta.IsStatusConditionTrue(conditions, v1.Failed) { continue } - provisioned := apimeta.FindStatusCondition(conditions, v1beta1.Provisioned) + provisioned := apimeta.FindStatusCondition(conditions, v1.Provisioned) if provisioned != nil && provisioned.Status == metav1.ConditionTrue { if provisioned.LastTransitionTime.Add(defaultReservationTime).Before(p.now()) { expiredProvReq = append(expiredProvReq, provReq) @@ -103,7 +103,7 @@ func (p *provReqProcessor) refresh(provReqs []*provreqwrapper.ProvisioningReques } } for _, provReq := range expiredProvReq { - conditions.AddOrUpdateCondition(provReq, v1beta1.BookingExpired, metav1.ConditionTrue, conditions.CapacityReservationTimeExpiredReason, conditions.CapacityReservationTimeExpiredMsg, metav1.NewTime(p.now())) + conditions.AddOrUpdateCondition(provReq, v1.BookingExpired, metav1.ConditionTrue, conditions.CapacityReservationTimeExpiredReason, conditions.CapacityReservationTimeExpiredMsg, metav1.NewTime(p.now())) _, updErr := p.client.UpdateProvisioningRequest(provReq.ProvisioningRequest) if updErr != nil { klog.Errorf("failed to add BookingExpired condition to ProvReq %s/%s, err: %v", provReq.Namespace, provReq.Name, updErr) @@ -111,7 +111,7 @@ func (p *provReqProcessor) refresh(provReqs []*provreqwrapper.ProvisioningReques } } for _, provReq := range failedProvReq { - conditions.AddOrUpdateCondition(provReq, v1beta1.Failed, metav1.ConditionTrue, conditions.ExpiredReason, conditions.ExpiredMsg, metav1.NewTime(p.now())) + conditions.AddOrUpdateCondition(provReq, v1.Failed, metav1.ConditionTrue, conditions.ExpiredReason, conditions.ExpiredMsg, metav1.NewTime(p.now())) _, updErr := p.client.UpdateProvisioningRequest(provReq.ProvisioningRequest) if updErr != nil { klog.Errorf("failed to add Failed condition to ProvReq %s/%s, err: %v", provReq.Namespace, provReq.Name, updErr) @@ -150,7 +150,7 @@ func (p *provReqProcessor) bookCapacity(ctx *context.AutoscalingContext) error { // ClusterAutoscaler was able to create pods before, so we shouldn't have error here. // If there is an error, mark PR as invalid, because we won't be able to book capacity // for it anyway. - conditions.AddOrUpdateCondition(provReq, v1beta1.Failed, metav1.ConditionTrue, conditions.FailedToBookCapacityReason, fmt.Sprintf("Couldn't create pods, err: %v", err), metav1.Now()) + conditions.AddOrUpdateCondition(provReq, v1.Failed, metav1.ConditionTrue, conditions.FailedToBookCapacityReason, fmt.Sprintf("Couldn't create pods, err: %v", err), metav1.Now()) if _, err := p.client.UpdateProvisioningRequest(provReq.ProvisioningRequest); err != nil { klog.Errorf("failed to add Accepted condition to ProvReq %s/%s, err: %v", provReq.Namespace, provReq.Name, err) } diff --git a/cluster-autoscaler/processors/provreq/processor_test.go b/cluster-autoscaler/processors/provreq/processor_test.go index 2a592fd6ee4a..e2eb8cae9e95 100644 --- a/cluster-autoscaler/processors/provreq/processor_test.go +++ b/cluster-autoscaler/processors/provreq/processor_test.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/kubernetes/pkg/scheduler/framework" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/config" . "k8s.io/autoscaler/cluster-autoscaler/core/test" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/conditions" @@ -56,7 +56,7 @@ func TestRefresh(t *testing.T) { creationTime: weekAgo, wantConditions: []metav1.Condition{ { - Type: v1beta1.Failed, + Type: v1.Failed, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(now), Reason: conditions.ExpiredReason, @@ -69,7 +69,7 @@ func TestRefresh(t *testing.T) { creationTime: weekAgo, conditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, + Type: v1.Provisioned, Status: metav1.ConditionFalse, LastTransitionTime: metav1.NewTime(dayAgo), Reason: conditions.ExpiredReason, @@ -78,14 +78,14 @@ func TestRefresh(t *testing.T) { }, wantConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, + Type: v1.Provisioned, Status: metav1.ConditionFalse, LastTransitionTime: metav1.NewTime(dayAgo), Reason: conditions.ExpiredReason, Message: conditions.ExpiredMsg, }, { - Type: v1beta1.Failed, + Type: v1.Failed, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(now), Reason: conditions.ExpiredReason, @@ -98,7 +98,7 @@ func TestRefresh(t *testing.T) { creationTime: dayAgo, conditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, + Type: v1.Provisioned, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(dayAgo), Reason: conditions.ExpiredReason, @@ -107,14 +107,14 @@ func TestRefresh(t *testing.T) { }, wantConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, + Type: v1.Provisioned, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(dayAgo), Reason: conditions.ExpiredReason, Message: conditions.ExpiredMsg, }, { - Type: v1beta1.BookingExpired, + Type: v1.BookingExpired, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(now), Reason: conditions.CapacityReservationTimeExpiredReason, @@ -127,7 +127,7 @@ func TestRefresh(t *testing.T) { creationTime: dayAgo, conditions: []metav1.Condition{ { - Type: v1beta1.Failed, + Type: v1.Failed, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(dayAgo), Reason: "Failed", @@ -136,7 +136,7 @@ func TestRefresh(t *testing.T) { }, wantConditions: []metav1.Condition{ { - Type: v1beta1.Failed, + Type: v1.Failed, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(dayAgo), Reason: "Failed", @@ -149,17 +149,17 @@ func TestRefresh(t *testing.T) { pr := provreqclient.ProvisioningRequestWrapperForTesting("namespace", "name-1") pr.Status.Conditions = test.conditions pr.CreationTimestamp = metav1.NewTime(test.creationTime) - pr.Spec.ProvisioningClassName = v1beta1.ProvisioningClassCheckCapacity + pr.Spec.ProvisioningClassName = v1.ProvisioningClassCheckCapacity additionalPr := provreqclient.ProvisioningRequestWrapperForTesting("namespace", "additional") additionalPr.CreationTimestamp = metav1.NewTime(weekAgo) - additionalPr.Spec.ProvisioningClassName = v1beta1.ProvisioningClassCheckCapacity + additionalPr.Spec.ProvisioningClassName = v1.ProvisioningClassCheckCapacity processor := provReqProcessor{func() time.Time { return now }, 1, provreqclient.NewFakeProvisioningRequestClient(nil, t, pr, additionalPr), nil} processor.refresh([]*provreqwrapper.ProvisioningRequest{pr, additionalPr}) assert.ElementsMatch(t, test.wantConditions, pr.Status.Conditions) if len(test.conditions) == len(test.wantConditions) { assert.ElementsMatch(t, []metav1.Condition{ { - Type: v1beta1.Failed, + Type: v1.Failed, Status: metav1.ConditionTrue, LastTransitionTime: metav1.NewTime(now), Reason: conditions.ExpiredReason, @@ -190,37 +190,37 @@ func TestBookCapacity(t *testing.T) { }{ { name: "ProvReq is new, check-capacity class", - provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1beta1.ProvisioningClassCheckCapacity), + provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1.ProvisioningClassCheckCapacity), capacityIsBooked: false, }, { name: "ProvReq is Failed, best-effort-atomic class", - conditions: []string{v1beta1.Failed}, - provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1beta1.ProvisioningClassBestEffortAtomicScaleUp), + conditions: []string{v1.Failed}, + provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1.ProvisioningClassBestEffortAtomicScaleUp), capacityIsBooked: false, }, { name: "ProvReq is Provisioned, unknown class", - conditions: []string{v1beta1.Provisioned}, + conditions: []string{v1.Provisioned}, provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), "unknown"), capacityIsBooked: false, }, { name: "ProvReq is Provisioned, capacity should be booked, check-capacity class", - conditions: []string{v1beta1.Provisioned}, - provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1beta1.ProvisioningClassCheckCapacity), + conditions: []string{v1.Provisioned}, + provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1.ProvisioningClassCheckCapacity), capacityIsBooked: true, }, { name: "ProvReq is Provisioned, capacity should be booked, best-effort-atomic class", - conditions: []string{v1beta1.Provisioned}, - provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1beta1.ProvisioningClassBestEffortAtomicScaleUp), + conditions: []string{v1.Provisioned}, + provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1.ProvisioningClassBestEffortAtomicScaleUp), capacityIsBooked: true, }, { name: "ProvReq has BookingExpired, capacity should not be booked, best-effort-atomic class", - conditions: []string{v1beta1.Provisioned, v1beta1.BookingExpired}, - provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1beta1.ProvisioningClassBestEffortAtomicScaleUp), + conditions: []string{v1.Provisioned, v1.BookingExpired}, + provReq: provreqwrapper.BuildTestProvisioningRequest("ns", "pr", "2", "100m", "", 10, false, time.Now(), v1.ProvisioningClassBestEffortAtomicScaleUp), capacityIsBooked: false, }, } diff --git a/cluster-autoscaler/provisioningrequest/besteffortatomic/provisioning_class.go b/cluster-autoscaler/provisioningrequest/besteffortatomic/provisioning_class.go index 4adf8471d427..122312b622cc 100644 --- a/cluster-autoscaler/provisioningrequest/besteffortatomic/provisioning_class.go +++ b/cluster-autoscaler/provisioningrequest/besteffortatomic/provisioning_class.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog/v2" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/core/scaleup" @@ -82,7 +82,7 @@ func (o *bestEffortAtomicProvClass) Provision( return &status.ScaleUpStatus{Result: status.ScaleUpNotTried}, nil } prs := provreqclient.ProvisioningRequestsForPods(o.client, unschedulablePods) - prs = provreqclient.FilterOutProvisioningClass(prs, v1beta1.ProvisioningClassBestEffortAtomicScaleUp) + prs = provreqclient.FilterOutProvisioningClass(prs, v1.ProvisioningClassBestEffortAtomicScaleUp) if len(prs) == 0 { return &status.ScaleUpStatus{Result: status.ScaleUpNotTried}, nil } @@ -95,7 +95,7 @@ func (o *bestEffortAtomicProvClass) Provision( // For provisioning requests, unschedulablePods are actually all injected pods. Some may even be schedulable! actuallyUnschedulablePods, err := o.filterOutSchedulable(unschedulablePods) if err != nil { - conditions.AddOrUpdateCondition(pr, v1beta1.Provisioned, metav1.ConditionFalse, conditions.FailedToCheckCapacityReason, conditions.FailedToCheckCapacityMsg, metav1.Now()) + conditions.AddOrUpdateCondition(pr, v1.Provisioned, metav1.ConditionFalse, conditions.FailedToCheckCapacityReason, conditions.FailedToCheckCapacityMsg, metav1.Now()) if _, updateErr := o.client.UpdateProvisioningRequest(pr.ProvisioningRequest); updateErr != nil { klog.Errorf("failed to add Provisioned=false condition to ProvReq %s/%s, err: %v", pr.Namespace, pr.Name, updateErr) } @@ -104,7 +104,7 @@ func (o *bestEffortAtomicProvClass) Provision( if len(actuallyUnschedulablePods) == 0 { // Nothing to do here - everything fits without scale-up. - conditions.AddOrUpdateCondition(pr, v1beta1.Provisioned, metav1.ConditionTrue, conditions.CapacityIsFoundReason, conditions.CapacityIsFoundMsg, metav1.Now()) + conditions.AddOrUpdateCondition(pr, v1.Provisioned, metav1.ConditionTrue, conditions.CapacityIsFoundReason, conditions.CapacityIsFoundMsg, metav1.Now()) if _, updateErr := o.client.UpdateProvisioningRequest(pr.ProvisioningRequest); updateErr != nil { klog.Errorf("failed to add Provisioned=true condition to ProvReq %s/%s, err: %v", pr.Namespace, pr.Name, updateErr) return status.UpdateScaleUpError(&status.ScaleUpStatus{}, errors.NewAutoscalerError(errors.InternalError, "capacity available, but failed to admit workload: %s", updateErr.Error())) @@ -115,7 +115,7 @@ func (o *bestEffortAtomicProvClass) Provision( st, err := o.scaleUpOrchestrator.ScaleUp(actuallyUnschedulablePods, nodes, daemonSets, nodeInfos, true) if err == nil && st.Result == status.ScaleUpSuccessful { // Happy path - all is well. - conditions.AddOrUpdateCondition(pr, v1beta1.Provisioned, metav1.ConditionTrue, conditions.CapacityIsProvisionedReason, conditions.CapacityIsProvisionedMsg, metav1.Now()) + conditions.AddOrUpdateCondition(pr, v1.Provisioned, metav1.ConditionTrue, conditions.CapacityIsProvisionedReason, conditions.CapacityIsProvisionedMsg, metav1.Now()) if _, updateErr := o.client.UpdateProvisioningRequest(pr.ProvisioningRequest); updateErr != nil { klog.Errorf("failed to add Provisioned=true condition to ProvReq %s/%s, err: %v", pr.Namespace, pr.Name, updateErr) return st, errors.NewAutoscalerError(errors.InternalError, "scale up requested, but failed to admit workload: %s", updateErr.Error()) @@ -124,7 +124,7 @@ func (o *bestEffortAtomicProvClass) Provision( } // We are not happy with the results. - conditions.AddOrUpdateCondition(pr, v1beta1.Provisioned, metav1.ConditionFalse, conditions.CapacityIsNotFoundReason, "Capacity is not found, CA will try to find it later.", metav1.Now()) + conditions.AddOrUpdateCondition(pr, v1.Provisioned, metav1.ConditionFalse, conditions.CapacityIsNotFoundReason, "Capacity is not found, CA will try to find it later.", metav1.Now()) if _, updateErr := o.client.UpdateProvisioningRequest(pr.ProvisioningRequest); updateErr != nil { klog.Errorf("failed to add Provisioned=false condition to ProvReq %s/%s, err: %v", pr.Namespace, pr.Name, updateErr) } diff --git a/cluster-autoscaler/provisioningrequest/checkcapacity/provisioningclass.go b/cluster-autoscaler/provisioningrequest/checkcapacity/provisioningclass.go index c87f73bb73fe..bd86c0190f98 100644 --- a/cluster-autoscaler/provisioningrequest/checkcapacity/provisioningclass.go +++ b/cluster-autoscaler/provisioningrequest/checkcapacity/provisioningclass.go @@ -22,7 +22,7 @@ import ( appsv1 "k8s.io/api/apps/v1" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/estimator" @@ -75,7 +75,7 @@ func (o *checkCapacityProvClass) Provision( } prs := provreqclient.ProvisioningRequestsForPods(o.client, unschedulablePods) - prs = provreqclient.FilterOutProvisioningClass(prs, v1beta1.ProvisioningClassCheckCapacity) + prs = provreqclient.FilterOutProvisioningClass(prs, v1.ProvisioningClassCheckCapacity) if len(prs) == 0 { return &status.ScaleUpStatus{Result: status.ScaleUpNotTried}, nil } @@ -99,10 +99,10 @@ func (o *checkCapacityProvClass) checkcapacity(unschedulablePods []*apiv1.Pod, p capacityAvailable = true st, _, err := o.injector.TrySchedulePods(o.context.ClusterSnapshot, unschedulablePods, scheduling.ScheduleAnywhere, true) if len(st) < len(unschedulablePods) || err != nil { - conditions.AddOrUpdateCondition(provReq, v1beta1.Provisioned, metav1.ConditionFalse, conditions.CapacityIsNotFoundReason, "Capacity is not found, CA will try to find it later.", metav1.Now()) + conditions.AddOrUpdateCondition(provReq, v1.Provisioned, metav1.ConditionFalse, conditions.CapacityIsNotFoundReason, "Capacity is not found, CA will try to find it later.", metav1.Now()) capacityAvailable = false } else { - conditions.AddOrUpdateCondition(provReq, v1beta1.Provisioned, metav1.ConditionTrue, conditions.CapacityIsFoundReason, conditions.CapacityIsFoundMsg, metav1.Now()) + conditions.AddOrUpdateCondition(provReq, v1.Provisioned, metav1.ConditionTrue, conditions.CapacityIsFoundReason, conditions.CapacityIsFoundMsg, metav1.Now()) } _, updErr := o.client.UpdateProvisioningRequest(provReq.ProvisioningRequest) if updErr != nil { diff --git a/cluster-autoscaler/provisioningrequest/conditions/condition_test.go b/cluster-autoscaler/provisioningrequest/conditions/condition_test.go index 86e1c5e4a612..081b6b78d8c7 100644 --- a/cluster-autoscaler/provisioningrequest/conditions/condition_test.go +++ b/cluster-autoscaler/provisioningrequest/conditions/condition_test.go @@ -19,8 +19,8 @@ package conditions import ( "testing" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqwrapper" ) @@ -28,33 +28,33 @@ import ( func TestBookCapacity(t *testing.T) { tests := []struct { name string - prConditions []v1.Condition + prConditions []metav1.Condition want bool }{ { name: "BookingExpired", - prConditions: []v1.Condition{ + prConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, { - Type: v1beta1.BookingExpired, - Status: v1.ConditionTrue, + Type: v1.BookingExpired, + Status: metav1.ConditionTrue, }, }, want: false, }, { name: "Failed", - prConditions: []v1.Condition{ + prConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, { - Type: v1beta1.Failed, - Status: v1.ConditionTrue, + Type: v1.Failed, + Status: metav1.ConditionTrue, }, }, want: false, @@ -65,24 +65,24 @@ func TestBookCapacity(t *testing.T) { }, { name: "Capacity found and provisioned", - prConditions: []v1.Condition{ + prConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, }, want: true, }, { name: "Capacity is not found", - prConditions: []v1.Condition{ + prConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionFalse, + Type: v1.Provisioned, + Status: metav1.ConditionFalse, }, }, want: false, @@ -92,11 +92,11 @@ func TestBookCapacity(t *testing.T) { t.Run(test.name, func(t *testing.T) { for class := range provisioningrequest.SupportedProvisioningClasses { pr := provreqwrapper.NewProvisioningRequest( - &v1beta1.ProvisioningRequest{ - Spec: v1beta1.ProvisioningRequestSpec{ + &v1.ProvisioningRequest{ + Spec: v1.ProvisioningRequestSpec{ ProvisioningClassName: class, }, - Status: v1beta1.ProvisioningRequestStatus{ + Status: v1.ProvisioningRequestStatus{ Conditions: test.prConditions, }, }, nil) @@ -112,138 +112,138 @@ func TestBookCapacity(t *testing.T) { func TestSetCondition(t *testing.T) { tests := []struct { name string - oldConditions []v1.Condition + oldConditions []metav1.Condition newType string - newStatus v1.ConditionStatus - want []v1.Condition + newStatus metav1.ConditionStatus + want []metav1.Condition }{ { name: "Accepted added, empty conditions before", - newType: v1beta1.Accepted, - newStatus: v1.ConditionTrue, - want: []v1.Condition{ + newType: v1.Accepted, + newStatus: metav1.ConditionTrue, + want: []metav1.Condition{ { - Type: v1beta1.Accepted, - Status: v1.ConditionTrue, + Type: v1.Accepted, + Status: metav1.ConditionTrue, }, }, }, { name: "Provisioned added, empty conditions before", - newType: v1beta1.Provisioned, - newStatus: v1.ConditionTrue, - want: []v1.Condition{ + newType: v1.Provisioned, + newStatus: metav1.ConditionTrue, + want: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, }, }, { name: "Provisioned updated", - oldConditions: []v1.Condition{ + oldConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionFalse, + Type: v1.Provisioned, + Status: metav1.ConditionFalse, }, }, - newType: v1beta1.Provisioned, - newStatus: v1.ConditionTrue, - want: []v1.Condition{ + newType: v1.Provisioned, + newStatus: metav1.ConditionTrue, + want: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, }, }, { name: "Failed added, non-empty conditions before", - oldConditions: []v1.Condition{ + oldConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, }, - newType: v1beta1.Failed, - newStatus: v1.ConditionTrue, - want: []v1.Condition{ + newType: v1.Failed, + newStatus: metav1.ConditionTrue, + want: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, { - Type: v1beta1.Failed, - Status: v1.ConditionTrue, + Type: v1.Failed, + Status: metav1.ConditionTrue, }, }, }, { name: "Unknown condition status, conditions are updated", - oldConditions: []v1.Condition{ + oldConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, }, - newType: v1beta1.Failed, - newStatus: v1.ConditionUnknown, - want: []v1.Condition{ + newType: v1.Failed, + newStatus: metav1.ConditionUnknown, + want: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, { - Type: v1beta1.Failed, - Status: v1.ConditionUnknown, + Type: v1.Failed, + Status: metav1.ConditionUnknown, }, }, }, { name: "Unknown condition type, conditions are not updated", - oldConditions: []v1.Condition{ + oldConditions: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, }, newType: "Unknown", - newStatus: v1.ConditionTrue, - want: []v1.Condition{ + newStatus: metav1.ConditionTrue, + want: []metav1.Condition{ { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, }, }, { name: "BookingExpired, empty conditions before", - newType: v1beta1.BookingExpired, - newStatus: v1.ConditionFalse, - want: []v1.Condition{ + newType: v1.BookingExpired, + newStatus: metav1.ConditionFalse, + want: []metav1.Condition{ { - Type: v1beta1.BookingExpired, - Status: v1.ConditionFalse, + Type: v1.BookingExpired, + Status: metav1.ConditionFalse, }, }, }, { name: "Capacity found with unknown condition before", - oldConditions: []v1.Condition{ + oldConditions: []metav1.Condition{ { Type: "unknown", - Status: v1.ConditionTrue, + Status: metav1.ConditionTrue, }, }, - newType: v1beta1.Provisioned, - newStatus: v1.ConditionTrue, - want: []v1.Condition{ + newType: v1.Provisioned, + newStatus: metav1.ConditionTrue, + want: []metav1.Condition{ { Type: "unknown", - Status: v1.ConditionTrue, + Status: metav1.ConditionTrue, }, { - Type: v1beta1.Provisioned, - Status: v1.ConditionTrue, + Type: v1.Provisioned, + Status: metav1.ConditionTrue, }, }, }, @@ -251,12 +251,12 @@ func TestSetCondition(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { pr := provreqwrapper.NewProvisioningRequest( - &v1beta1.ProvisioningRequest{ - Status: v1beta1.ProvisioningRequestStatus{ + &v1.ProvisioningRequest{ + Status: v1.ProvisioningRequestStatus{ Conditions: test.oldConditions, }, }, nil) - AddOrUpdateCondition(pr, test.newType, test.newStatus, "", "", v1.Now()) + AddOrUpdateCondition(pr, test.newType, test.newStatus, "", "", metav1.Now()) got := pr.Status.Conditions if len(got) > 2 || len(got) != len(test.want) || got[0].Type != test.want[0].Type || got[0].Status != test.want[0].Status { t.Errorf("want %v, got: %v", test.want, got) diff --git a/cluster-autoscaler/provisioningrequest/conditions/conditions.go b/cluster-autoscaler/provisioningrequest/conditions/conditions.go index 2688c2d0b41b..33a66d1478a5 100644 --- a/cluster-autoscaler/provisioningrequest/conditions/conditions.go +++ b/cluster-autoscaler/provisioningrequest/conditions/conditions.go @@ -19,7 +19,7 @@ package conditions import ( apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqwrapper" "k8s.io/klog/v2" @@ -64,9 +64,9 @@ func ShouldCapacityBeBooked(pr *provreqwrapper.ProvisioningRequest) bool { return false } conditions := pr.Status.Conditions - if apimeta.IsStatusConditionTrue(conditions, v1beta1.Failed) || apimeta.IsStatusConditionTrue(conditions, v1beta1.BookingExpired) { + if apimeta.IsStatusConditionTrue(conditions, v1.Failed) || apimeta.IsStatusConditionTrue(conditions, v1.BookingExpired) { return false - } else if apimeta.IsStatusConditionTrue(conditions, v1beta1.Provisioned) { + } else if apimeta.IsStatusConditionTrue(conditions, v1.Provisioned) { return true } return false @@ -85,7 +85,7 @@ func AddOrUpdateCondition(pr *provreqwrapper.ProvisioningRequest, conditionType } prevConditions := pr.Status.Conditions switch conditionType { - case v1beta1.Provisioned, v1beta1.BookingExpired, v1beta1.Failed, v1beta1.Accepted: + case v1.Provisioned, v1.BookingExpired, v1.Failed, v1.Accepted: conditionFound := false for _, condition := range prevConditions { if condition.Type == conditionType { diff --git a/cluster-autoscaler/provisioningrequest/orchestrator/orchestrator_test.go b/cluster-autoscaler/provisioningrequest/orchestrator/orchestrator_test.go index 658c4f7341c7..bd3568aa4faa 100644 --- a/cluster-autoscaler/provisioningrequest/orchestrator/orchestrator_test.go +++ b/cluster-autoscaler/provisioningrequest/orchestrator/orchestrator_test.go @@ -23,10 +23,10 @@ import ( "time" "github.com/stretchr/testify/assert" - v1 "k8s.io/api/apps/v1" + appsv1 "k8s.io/api/apps/v1" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" testprovider "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/test" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/config" @@ -75,7 +75,7 @@ func TestScaleUp(t *testing.T) { CPU: "5m", Memory: "5", PodCount: int32(100), - Class: v1beta1.ProvisioningClassCheckCapacity, + Class: v1.ProvisioningClassCheckCapacity, }) newCheckCapacityMemProvReq := provreqwrapper.BuildValidTestProvisioningRequestFromOptions( @@ -84,7 +84,7 @@ func TestScaleUp(t *testing.T) { CPU: "1m", Memory: "100", PodCount: int32(100), - Class: v1beta1.ProvisioningClassCheckCapacity, + Class: v1.ProvisioningClassCheckCapacity, }) // Active atomic scale up requests. @@ -94,7 +94,7 @@ func TestScaleUp(t *testing.T) { CPU: "5m", Memory: "5", PodCount: int32(5), - Class: v1beta1.ProvisioningClassBestEffortAtomicScaleUp, + Class: v1.ProvisioningClassBestEffortAtomicScaleUp, }) largeAtomicScaleUpProvReq := provreqwrapper.BuildValidTestProvisioningRequestFromOptions( provreqwrapper.TestProvReqOptions{ @@ -102,7 +102,7 @@ func TestScaleUp(t *testing.T) { CPU: "1m", Memory: "100", PodCount: int32(100), - Class: v1beta1.ProvisioningClassBestEffortAtomicScaleUp, + Class: v1.ProvisioningClassBestEffortAtomicScaleUp, }) impossibleAtomicScaleUpReq := provreqwrapper.BuildValidTestProvisioningRequestFromOptions( provreqwrapper.TestProvReqOptions{ @@ -110,7 +110,7 @@ func TestScaleUp(t *testing.T) { CPU: "1m", Memory: "1", PodCount: int32(5001), - Class: v1beta1.ProvisioningClassBestEffortAtomicScaleUp, + Class: v1.ProvisioningClassBestEffortAtomicScaleUp, }) possibleAtomicScaleUpReq := provreqwrapper.BuildValidTestProvisioningRequestFromOptions( provreqwrapper.TestProvReqOptions{ @@ -118,7 +118,7 @@ func TestScaleUp(t *testing.T) { CPU: "100m", Memory: "1", PodCount: int32(120), - Class: v1beta1.ProvisioningClassBestEffortAtomicScaleUp, + Class: v1.ProvisioningClassBestEffortAtomicScaleUp, }) autoprovisioningAtomicScaleUpReq := provreqwrapper.BuildValidTestProvisioningRequestFromOptions( provreqwrapper.TestProvReqOptions{ @@ -126,7 +126,7 @@ func TestScaleUp(t *testing.T) { CPU: "100m", Memory: "100", PodCount: int32(5), - Class: v1beta1.ProvisioningClassBestEffortAtomicScaleUp, + Class: v1.ProvisioningClassBestEffortAtomicScaleUp, }) // Already provisioned provisioning request - capacity should be booked before processing a new request. @@ -137,9 +137,9 @@ func TestScaleUp(t *testing.T) { CPU: "1m", Memory: "200", PodCount: int32(100), - Class: v1beta1.ProvisioningClassCheckCapacity, + Class: v1.ProvisioningClassCheckCapacity, }) - bookedCapacityProvReq.SetConditions([]metav1.Condition{{Type: v1beta1.Provisioned, Status: metav1.ConditionTrue, LastTransitionTime: metav1.Now()}}) + bookedCapacityProvReq.SetConditions([]metav1.Condition{{Type: v1.Provisioned, Status: metav1.ConditionTrue, LastTransitionTime: metav1.Now()}}) // Expired provisioning request - should be ignored. expiredProvReq := provreqwrapper.BuildValidTestProvisioningRequestFromOptions( @@ -148,9 +148,9 @@ func TestScaleUp(t *testing.T) { CPU: "1m", Memory: "200", PodCount: int32(100), - Class: v1beta1.ProvisioningClassCheckCapacity, + Class: v1.ProvisioningClassCheckCapacity, }) - expiredProvReq.SetConditions([]metav1.Condition{{Type: v1beta1.BookingExpired, Status: metav1.ConditionTrue, LastTransitionTime: metav1.Now()}}) + expiredProvReq.SetConditions([]metav1.Condition{{Type: v1.BookingExpired, Status: metav1.ConditionTrue, LastTransitionTime: metav1.Now()}}) // Unsupported provisioning request - should be ignored. unsupportedProvReq := provreqwrapper.BuildValidTestProvisioningRequestFromOptions( @@ -254,7 +254,7 @@ func TestScaleUp(t *testing.T) { } orchestrator, nodeInfos := setupTest(t, allNodes, tc.provReqs, onScaleUpFunc, tc.autoprovisioning) - st, err := orchestrator.ScaleUp(prPods, []*apiv1.Node{}, []*v1.DaemonSet{}, nodeInfos, false) + st, err := orchestrator.ScaleUp(prPods, []*apiv1.Node{}, []*appsv1.DaemonSet{}, nodeInfos, false) if !tc.err { assert.NoError(t, err) if tc.scaleUpResult != st.Result && len(st.PodsRemainUnschedulable) > 0 { @@ -304,7 +304,7 @@ func setupTest(t *testing.T, nodes []*apiv1.Node, prs []*provreqwrapper.Provisio } now := time.Now() - nodeInfos, err := nodeinfosprovider.NewDefaultTemplateNodeInfoProvider(nil, false).Process(&autoscalingContext, nodes, []*v1.DaemonSet{}, taints.TaintConfig{}, now) + nodeInfos, err := nodeinfosprovider.NewDefaultTemplateNodeInfoProvider(nil, false).Process(&autoscalingContext, nodes, []*appsv1.DaemonSet{}, taints.TaintConfig{}, now) assert.NoError(t, err) options := config.AutoscalingOptions{ diff --git a/cluster-autoscaler/provisioningrequest/orchestrator/wrapper_orchestrator.go b/cluster-autoscaler/provisioningrequest/orchestrator/wrapper_orchestrator.go index c74e4a1148ab..07a902b2e54b 100644 --- a/cluster-autoscaler/provisioningrequest/orchestrator/wrapper_orchestrator.go +++ b/cluster-autoscaler/provisioningrequest/orchestrator/wrapper_orchestrator.go @@ -19,7 +19,7 @@ package orchestrator import ( appsv1 "k8s.io/api/apps/v1" apiv1 "k8s.io/api/core/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/core/scaleup" @@ -87,7 +87,7 @@ func (o *WrapperOrchestrator) ScaleUp( func splitOut(unschedulablePods []*apiv1.Pod) (provReqPods, regularPods []*apiv1.Pod) { for _, pod := range unschedulablePods { - if _, ok := pod.Annotations[v1beta1.ProvisioningRequestPodAnnotationKey]; ok { + if _, ok := pod.Annotations[v1.ProvisioningRequestPodAnnotationKey]; ok { provReqPods = append(provReqPods, pod) } else { regularPods = append(regularPods, pod) diff --git a/cluster-autoscaler/provisioningrequest/orchestrator/wrapper_orchestrator_test.go b/cluster-autoscaler/provisioningrequest/orchestrator/wrapper_orchestrator_test.go index 814a213b340f..64644ee8d3f3 100644 --- a/cluster-autoscaler/provisioningrequest/orchestrator/wrapper_orchestrator_test.go +++ b/cluster-autoscaler/provisioningrequest/orchestrator/wrapper_orchestrator_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" appsv1 "k8s.io/api/apps/v1" apiv1 "k8s.io/api/core/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/clusterstate" "k8s.io/autoscaler/cluster-autoscaler/context" "k8s.io/autoscaler/cluster-autoscaler/estimator" @@ -53,7 +53,7 @@ func TestWrapperScaleUp(t *testing.T) { BuildTestPod("pr-pod-2", 1, 100), } for _, pod := range provReqPods { - pod.Annotations[v1beta1.ProvisioningRequestPodAnnotationKey] = "true" + pod.Annotations[v1.ProvisioningRequestPodAnnotationKey] = "true" } unschedulablePods := append(regularPods, provReqPods...) _, err := o.ScaleUp(unschedulablePods, nil, nil, nil, false) diff --git a/cluster-autoscaler/provisioningrequest/pods/pods.go b/cluster-autoscaler/provisioningrequest/pods/pods.go index 4d8ef3e378a1..bf401a345198 100644 --- a/cluster-autoscaler/provisioningrequest/pods/pods.go +++ b/cluster-autoscaler/provisioningrequest/pods/pods.go @@ -20,12 +20,12 @@ import ( "fmt" "google.golang.org/protobuf/proto" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqwrapper" - corev1 "k8s.io/kubernetes/pkg/apis/core/v1" + apiscorev1 "k8s.io/kubernetes/pkg/apis/core/v1" "k8s.io/kubernetes/pkg/controller" ) @@ -38,7 +38,7 @@ const ( // PodsForProvisioningRequest returns a list of pods for which Provisioning // Request needs to provision resources. -func PodsForProvisioningRequest(pr *provreqwrapper.ProvisioningRequest) ([]*v1.Pod, error) { +func PodsForProvisioningRequest(pr *provreqwrapper.ProvisioningRequest) ([]*corev1.Pod, error) { if pr == nil { return nil, nil } @@ -46,7 +46,7 @@ func PodsForProvisioningRequest(pr *provreqwrapper.ProvisioningRequest) ([]*v1.P if err != nil { return nil, err } - pods := make([]*v1.Pod, 0) + pods := make([]*corev1.Pod, 0) for i, podSet := range podSets { for j := 0; j < int(podSet.Count); j++ { pod, err := controller.GetPodFromTemplate(&podSet.PodTemplate, pr.ProvisioningRequest, ownerReference(pr)) @@ -54,7 +54,7 @@ func PodsForProvisioningRequest(pr *provreqwrapper.ProvisioningRequest) ([]*v1.P return nil, fmt.Errorf("while creating pod for pr: %s/%s podSet: %d, got error: %w", pr.Namespace, pr.Name, i, err) } populatePodFields(pr, pod, i, j) - corev1.SetDefaults_Pod(pod) + apiscorev1.SetDefaults_Pod(pod) pods = append(pods, pod) } } @@ -74,14 +74,14 @@ func ownerReference(pr *provreqwrapper.ProvisioningRequest) *metav1.OwnerReferen } } -func populatePodFields(pr *provreqwrapper.ProvisioningRequest, pod *v1.Pod, i, j int) { +func populatePodFields(pr *provreqwrapper.ProvisioningRequest, pod *corev1.Pod, i, j int) { pod.Name = fmt.Sprintf("%s%d-%d", pod.GenerateName, i, j) pod.Namespace = pr.Namespace if pod.Annotations == nil { pod.Annotations = make(map[string]string) } - pod.Annotations[v1beta1.ProvisioningRequestPodAnnotationKey] = pr.Name - pod.Annotations[v1beta1.ProvisioningClassPodAnnotationKey] = pr.Spec.ProvisioningClassName + pod.Annotations[v1.ProvisioningRequestPodAnnotationKey] = pr.Name + pod.Annotations[v1.ProvisioningClassPodAnnotationKey] = pr.Spec.ProvisioningClassName pod.UID = types.UID(fmt.Sprintf("%s/%s", pod.Namespace, pod.Name)) pod.CreationTimestamp = pr.CreationTimestamp } diff --git a/cluster-autoscaler/provisioningrequest/pods/pods_test.go b/cluster-autoscaler/provisioningrequest/pods/pods_test.go index 82cd3c498759..48bdf0c78c6c 100644 --- a/cluster-autoscaler/provisioningrequest/pods/pods_test.go +++ b/cluster-autoscaler/provisioningrequest/pods/pods_test.go @@ -23,11 +23,11 @@ import ( "github.com/google/go-cmp/cmp" "google.golang.org/protobuf/proto" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqwrapper" "k8s.io/utils/ptr" ) @@ -35,16 +35,16 @@ import ( const testProvisioningClassName = "TestProvisioningClass" func TestPodsForProvisioningRequest(t *testing.T) { - testPod := func(name, genName, containerName, containerImage, prName string) *v1.Pod { - return &v1.Pod{ + testPod := func(name, genName, containerName, containerImage, prName string) *corev1.Pod { + return &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: name, GenerateName: genName, Namespace: "test-namespace", UID: types.UID(fmt.Sprintf("test-namespace/%s", name)), Annotations: map[string]string{ - v1beta1.ProvisioningRequestPodAnnotationKey: prName, - v1beta1.ProvisioningClassPodAnnotationKey: testProvisioningClassName, + v1.ProvisioningRequestPodAnnotationKey: prName, + v1.ProvisioningClassPodAnnotationKey: testProvisioningClassName, }, Labels: map[string]string{}, Finalizers: []string{}, @@ -55,8 +55,8 @@ func TestPodsForProvisioningRequest(t *testing.T) { }, }, }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ { Name: containerName, Image: containerImage, @@ -69,37 +69,37 @@ func TestPodsForProvisioningRequest(t *testing.T) { tests := []struct { desc string - pr *v1beta1.ProvisioningRequest - podTemplates []*v1.PodTemplate - want []*v1.Pod + pr *v1.ProvisioningRequest + podTemplates []*corev1.PodTemplate + want []*corev1.Pod wantErr bool }{ { desc: "simple ProvReq", - pr: &v1beta1.ProvisioningRequest{ + pr: &v1.ProvisioningRequest{ ObjectMeta: metav1.ObjectMeta{ Name: "test-pr-name", Namespace: "test-namespace", }, - Spec: v1beta1.ProvisioningRequestSpec{ - PodSets: []v1beta1.PodSet{ + Spec: v1.ProvisioningRequestSpec{ + PodSets: []v1.PodSet{ { Count: 1, - PodTemplateRef: v1beta1.Reference{Name: "template-1"}, + PodTemplateRef: v1.Reference{Name: "template-1"}, }, }, ProvisioningClassName: testProvisioningClassName, }, }, - podTemplates: []*v1.PodTemplate{ + podTemplates: []*corev1.PodTemplate{ { ObjectMeta: metav1.ObjectMeta{ Name: "template-1", Namespace: "test-namespace", }, - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ { Name: "test-container", Image: "test-image", @@ -109,36 +109,36 @@ func TestPodsForProvisioningRequest(t *testing.T) { }, }, }, - want: []*v1.Pod{ + want: []*corev1.Pod{ testPod("test-pr-name-0-0", "test-pr-name-", "test-container", "test-image", "test-pr-name"), }, }, { desc: "ProvReq already having taint", - pr: &v1beta1.ProvisioningRequest{ + pr: &v1.ProvisioningRequest{ ObjectMeta: metav1.ObjectMeta{ Name: "test-pr-name", Namespace: "test-namespace", }, - Spec: v1beta1.ProvisioningRequestSpec{ - PodSets: []v1beta1.PodSet{ + Spec: v1.ProvisioningRequestSpec{ + PodSets: []v1.PodSet{ { Count: 1, - PodTemplateRef: v1beta1.Reference{Name: "template-1"}, + PodTemplateRef: v1.Reference{Name: "template-1"}, }, }, ProvisioningClassName: testProvisioningClassName, }, }, - podTemplates: []*v1.PodTemplate{ + podTemplates: []*corev1.PodTemplate{ { ObjectMeta: metav1.ObjectMeta{ Name: "template-1", Namespace: "test-namespace", }, - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ { Name: "test-container", Image: "test-image", @@ -148,36 +148,36 @@ func TestPodsForProvisioningRequest(t *testing.T) { }, }, }, - want: []*v1.Pod{ + want: []*corev1.Pod{ testPod("test-pr-name-0-0", "test-pr-name-", "test-container", "test-image", "test-pr-name"), }, }, { desc: "ProvReq already having nodeSelector", - pr: &v1beta1.ProvisioningRequest{ + pr: &v1.ProvisioningRequest{ ObjectMeta: metav1.ObjectMeta{ Name: "test-pr-name", Namespace: "test-namespace", }, - Spec: v1beta1.ProvisioningRequestSpec{ - PodSets: []v1beta1.PodSet{ + Spec: v1.ProvisioningRequestSpec{ + PodSets: []v1.PodSet{ { Count: 1, - PodTemplateRef: v1beta1.Reference{Name: "template-1"}, + PodTemplateRef: v1.Reference{Name: "template-1"}, }, }, ProvisioningClassName: testProvisioningClassName, }, }, - podTemplates: []*v1.PodTemplate{ + podTemplates: []*corev1.PodTemplate{ { ObjectMeta: metav1.ObjectMeta{ Name: "template-1", Namespace: "test-namespace", }, - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ { Name: "test-container", Image: "test-image", @@ -187,40 +187,40 @@ func TestPodsForProvisioningRequest(t *testing.T) { }, }, }, - want: []*v1.Pod{ + want: []*corev1.Pod{ testPod("test-pr-name-0-0", "test-pr-name-", "test-container", "test-image", "test-pr-name"), }, }, { desc: "ProvReq with multiple pod sets", - pr: &v1beta1.ProvisioningRequest{ + pr: &v1.ProvisioningRequest{ ObjectMeta: metav1.ObjectMeta{ Name: "test-pr-name", Namespace: "test-namespace", }, - Spec: v1beta1.ProvisioningRequestSpec{ - PodSets: []v1beta1.PodSet{ + Spec: v1.ProvisioningRequestSpec{ + PodSets: []v1.PodSet{ { Count: 2, - PodTemplateRef: v1beta1.Reference{Name: "template-1"}, + PodTemplateRef: v1.Reference{Name: "template-1"}, }, { Count: 3, - PodTemplateRef: v1beta1.Reference{Name: "template-2"}, + PodTemplateRef: v1.Reference{Name: "template-2"}, }, }, ProvisioningClassName: testProvisioningClassName, }, }, - podTemplates: []*v1.PodTemplate{ + podTemplates: []*corev1.PodTemplate{ { ObjectMeta: metav1.ObjectMeta{ Name: "template-1", Namespace: "test-namespace", }, - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ { Name: "test-container", Image: "test-image", @@ -234,9 +234,9 @@ func TestPodsForProvisioningRequest(t *testing.T) { Name: "template-2", Namespace: "test-namespace", }, - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ { Name: "test-container-2", Image: "test-image-2", @@ -246,7 +246,7 @@ func TestPodsForProvisioningRequest(t *testing.T) { }, }, }, - want: []*v1.Pod{ + want: []*corev1.Pod{ testPod("test-pr-name-0-0", "test-pr-name-", "test-container", "test-image", "test-pr-name"), testPod("test-pr-name-0-1", "test-pr-name-", "test-container", "test-image", "test-pr-name"), testPod("test-pr-name-1-0", "test-pr-name-", "test-container-2", "test-image-2", "test-pr-name"), @@ -256,37 +256,37 @@ func TestPodsForProvisioningRequest(t *testing.T) { }, { desc: "PodTemplate doesn't specify container resources requests, Pods container default resources requests to limits", - pr: &v1beta1.ProvisioningRequest{ + pr: &v1.ProvisioningRequest{ ObjectMeta: metav1.ObjectMeta{ Name: "test-pr-name", Namespace: "test-namespace", }, - Spec: v1beta1.ProvisioningRequestSpec{ - PodSets: []v1beta1.PodSet{ + Spec: v1.ProvisioningRequestSpec{ + PodSets: []v1.PodSet{ { Count: 1, - PodTemplateRef: v1beta1.Reference{Name: "template-1"}, + PodTemplateRef: v1.Reference{Name: "template-1"}, }, }, ProvisioningClassName: testProvisioningClassName, }, }, - podTemplates: []*v1.PodTemplate{ + podTemplates: []*corev1.PodTemplate{ { ObjectMeta: metav1.ObjectMeta{ Name: "template-1", Namespace: "test-namespace", }, - Template: v1.PodTemplateSpec{ - Spec: v1.PodSpec{ - Containers: []v1.Container{ + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ { Name: "test-container", Image: "test-image", - Resources: v1.ResourceRequirements{ - Limits: v1.ResourceList{ - v1.ResourceCPU: resource.MustParse("8"), - v1.ResourceMemory: resource.MustParse("8G"), + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("8"), + corev1.ResourceMemory: resource.MustParse("8G"), }, }, }, @@ -295,7 +295,7 @@ func TestPodsForProvisioningRequest(t *testing.T) { }, }, }, - want: []*v1.Pod{ + want: []*corev1.Pod{ { ObjectMeta: metav1.ObjectMeta{ Name: "test-pr-name-0-0", @@ -303,8 +303,8 @@ func TestPodsForProvisioningRequest(t *testing.T) { Namespace: "test-namespace", UID: types.UID(fmt.Sprintf("test-namespace/%s", "test-pr-name-0-0")), Annotations: map[string]string{ - v1beta1.ProvisioningRequestPodAnnotationKey: "test-pr-name", - v1beta1.ProvisioningClassPodAnnotationKey: testProvisioningClassName, + v1.ProvisioningRequestPodAnnotationKey: "test-pr-name", + v1.ProvisioningClassPodAnnotationKey: testProvisioningClassName, }, Labels: map[string]string{}, Finalizers: []string{}, @@ -315,19 +315,19 @@ func TestPodsForProvisioningRequest(t *testing.T) { }, }, }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ { Name: "test-container", Image: "test-image", - Resources: v1.ResourceRequirements{ - Limits: v1.ResourceList{ - v1.ResourceCPU: resource.MustParse("8"), - v1.ResourceMemory: resource.MustParse("8G"), + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("8"), + corev1.ResourceMemory: resource.MustParse("8G"), }, - Requests: v1.ResourceList{ - v1.ResourceCPU: resource.MustParse("8"), - v1.ResourceMemory: resource.MustParse("8G"), + Requests: corev1.ResourceList{ + corev1.ResourceCPU: resource.MustParse("8"), + corev1.ResourceMemory: resource.MustParse("8G"), }, }, }, diff --git a/cluster-autoscaler/provisioningrequest/provreqclient/client.go b/cluster-autoscaler/provisioningrequest/provreqclient/client.go index d8963a4d9978..941c3f40c97a 100644 --- a/cluster-autoscaler/provisioningrequest/provreqclient/client.go +++ b/cluster-autoscaler/provisioningrequest/provreqclient/client.go @@ -26,14 +26,14 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned" "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/informers/externalversions" - listers "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1beta1" + listers "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/listers/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqwrapper" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" - v1 "k8s.io/client-go/listers/core/v1" + corev1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/rest" klog "k8s.io/klog/v2" @@ -43,11 +43,11 @@ const ( provisioningRequestClientCallTimeout = 4 * time.Second ) -// ProvisioningRequestClient represents client for v1beta1 ProvReq CRD. +// ProvisioningRequestClient represents client for v1 ProvReq CRD. type ProvisioningRequestClient struct { client versioned.Interface provReqLister listers.ProvisioningRequestLister - podTemplLister v1.PodTemplateLister + podTemplLister corev1.PodTemplateLister } // NewProvisioningRequestClient configures and returns a provisioningRequestClient. @@ -81,36 +81,36 @@ func NewProvisioningRequestClient(kubeConfig *rest.Config) (*ProvisioningRequest // ProvisioningRequest gets a specific ProvisioningRequest CR. func (c *ProvisioningRequestClient) ProvisioningRequest(namespace, name string) (*provreqwrapper.ProvisioningRequest, error) { - v1Beta1PR, err := c.provReqLister.ProvisioningRequests(namespace).Get(name) + v1PR, err := c.provReqLister.ProvisioningRequests(namespace).Get(name) if err != nil { return nil, err } - podTemplates, err := c.FetchPodTemplates(v1Beta1PR) + podTemplates, err := c.FetchPodTemplates(v1PR) if err != nil { return nil, fmt.Errorf("while fetching pod templates for Get Provisioning Request %s/%s got error: %v", namespace, name, err) } - return provreqwrapper.NewProvisioningRequest(v1Beta1PR, podTemplates), nil + return provreqwrapper.NewProvisioningRequest(v1PR, podTemplates), nil } // ProvisioningRequests gets all ProvisioningRequest CRs. func (c *ProvisioningRequestClient) ProvisioningRequests() ([]*provreqwrapper.ProvisioningRequest, error) { - v1Beta1PRs, err := c.provReqLister.List(labels.Everything()) + v1PRs, err := c.provReqLister.List(labels.Everything()) if err != nil { return nil, fmt.Errorf("error fetching provisioningRequests: %w", err) } - prs := make([]*provreqwrapper.ProvisioningRequest, 0, len(v1Beta1PRs)) - for _, v1Beta1PR := range v1Beta1PRs { - podTemplates, errPodTemplates := c.FetchPodTemplates(v1Beta1PR) + prs := make([]*provreqwrapper.ProvisioningRequest, 0, len(v1PRs)) + for _, v1PR := range v1PRs { + podTemplates, errPodTemplates := c.FetchPodTemplates(v1PR) if errPodTemplates != nil { - return nil, fmt.Errorf("while fetching pod templates for List Provisioning Request %s/%s got error: %v", v1Beta1PR.Namespace, v1Beta1PR.Name, errPodTemplates) + return nil, fmt.Errorf("while fetching pod templates for List Provisioning Request %s/%s got error: %v", v1PR.Namespace, v1PR.Name, errPodTemplates) } - prs = append(prs, provreqwrapper.NewProvisioningRequest(v1Beta1PR, podTemplates)) + prs = append(prs, provreqwrapper.NewProvisioningRequest(v1PR, podTemplates)) } return prs, nil } // FetchPodTemplates fetches PodTemplates referenced by the Provisioning Request. -func (c *ProvisioningRequestClient) FetchPodTemplates(pr *v1beta1.ProvisioningRequest) ([]*apiv1.PodTemplate, error) { +func (c *ProvisioningRequestClient) FetchPodTemplates(pr *v1.ProvisioningRequest) ([]*apiv1.PodTemplate, error) { podTemplates := make([]*apiv1.PodTemplate, 0, len(pr.Spec.PodSets)) for _, podSpec := range pr.Spec.PodSets { podTemplate, err := c.podTemplLister.PodTemplates(pr.Namespace).Get(podSpec.PodTemplateRef.Name) @@ -126,7 +126,7 @@ func (c *ProvisioningRequestClient) FetchPodTemplates(pr *v1beta1.ProvisioningRe } // UpdateProvisioningRequest updates the given ProvisioningRequest CR by propagating the changes using the ProvisioningRequestInterface and returns the updated instance or the original one in case of an error. -func (c *ProvisioningRequestClient) UpdateProvisioningRequest(pr *v1beta1.ProvisioningRequest) (*v1beta1.ProvisioningRequest, error) { +func (c *ProvisioningRequestClient) UpdateProvisioningRequest(pr *v1.ProvisioningRequest) (*v1.ProvisioningRequest, error) { ctx, cancel := context.WithTimeout(context.Background(), provisioningRequestClientCallTimeout) defer cancel() @@ -134,8 +134,8 @@ func (c *ProvisioningRequestClient) UpdateProvisioningRequest(pr *v1beta1.Provis // the default null template.metadata.creationTimestamp field of PodTemplateSpec // will not generate false error logs as a side effect. prCopy := pr.DeepCopy() - prCopy.Spec = v1beta1.ProvisioningRequestSpec{} - updatedPr, err := c.client.AutoscalingV1beta1().ProvisioningRequests(prCopy.Namespace).UpdateStatus(ctx, prCopy, metav1.UpdateOptions{}) + prCopy.Spec = v1.ProvisioningRequestSpec{} + updatedPr, err := c.client.AutoscalingV1().ProvisioningRequests(prCopy.Namespace).UpdateStatus(ctx, prCopy, metav1.UpdateOptions{}) if err != nil { return pr, err } @@ -151,7 +151,7 @@ func newPRClient(kubeConfig *rest.Config) (*versioned.Clientset, error) { // newPRsLister creates a lister for the Provisioning Requests in the cluster. func newPRsLister(prClient versioned.Interface, stopChannel <-chan struct{}) (listers.ProvisioningRequestLister, error) { factory := externalversions.NewSharedInformerFactory(prClient, 1*time.Hour) - provReqLister := factory.Autoscaling().V1beta1().ProvisioningRequests().Lister() + provReqLister := factory.Autoscaling().V1().ProvisioningRequests().Lister() factory.Start(stopChannel) informersSynced := factory.WaitForCacheSync(stopChannel) for _, synced := range informersSynced { @@ -164,7 +164,7 @@ func newPRsLister(prClient versioned.Interface, stopChannel <-chan struct{}) (li } // newPodTemplatesLister creates a lister for the Pod Templates in the cluster. -func newPodTemplatesLister(client *kubernetes.Clientset, stopChannel <-chan struct{}) (v1.PodTemplateLister, error) { +func newPodTemplatesLister(client *kubernetes.Clientset, stopChannel <-chan struct{}) (corev1.PodTemplateLister, error) { factory := informers.NewSharedInformerFactory(client, 1*time.Hour) podTemplLister := factory.Core().V1().PodTemplates().Lister() factory.Start(stopChannel) @@ -206,11 +206,11 @@ func ProvisioningRequestsForPods(client *ProvisioningRequestClient, unschedulabl } // DeleteProvisioningRequest deletes the given ProvisioningRequest CR using the ProvisioningRequestInterface and returns an error in case of failure. -func (c *ProvisioningRequestClient) DeleteProvisioningRequest(pr *v1beta1.ProvisioningRequest) error { +func (c *ProvisioningRequestClient) DeleteProvisioningRequest(pr *v1.ProvisioningRequest) error { ctx, cancel := context.WithTimeout(context.Background(), provisioningRequestClientCallTimeout) defer cancel() - err := c.client.AutoscalingV1beta1().ProvisioningRequests(pr.Namespace).Delete(ctx, pr.Name, metav1.DeleteOptions{}) + err := c.client.AutoscalingV1().ProvisioningRequests(pr.Namespace).Delete(ctx, pr.Name, metav1.DeleteOptions{}) if err != nil { return fmt.Errorf("error deleting ProvisioningRequest %s/%s: %w", pr.Namespace, pr.Name, err) } diff --git a/cluster-autoscaler/provisioningrequest/provreqclient/client_test.go b/cluster-autoscaler/provisioningrequest/provreqclient/client_test.go index 0ec9a610c62f..90abfde4d6e2 100644 --- a/cluster-autoscaler/provisioningrequest/provreqclient/client_test.go +++ b/cluster-autoscaler/provisioningrequest/provreqclient/client_test.go @@ -24,7 +24,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" apiv1 "k8s.io/api/core/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/pods" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqwrapper" . "k8s.io/autoscaler/cluster-autoscaler/utils/test" @@ -50,7 +50,7 @@ func TestFetchPodTemplates(t *testing.T) { } func TestProvisioningRequestsForPods(t *testing.T) { - checkCapacityProvReq := provreqwrapper.BuildTestProvisioningRequest("ns", "check-capacity", "1m", "100", "", int32(100), false, time.Now(), v1beta1.ProvisioningClassCheckCapacity) + checkCapacityProvReq := provreqwrapper.BuildTestProvisioningRequest("ns", "check-capacity", "1m", "100", "", int32(100), false, time.Now(), v1.ProvisioningClassCheckCapacity) customProvReq := provreqwrapper.BuildTestProvisioningRequest("ns", "custom", "1m", "100", "", int32(100), false, time.Now(), "custom") checkCapacityPods, _ := pods.PodsForProvisioningRequest(checkCapacityProvReq) customProvReqPods, _ := pods.PodsForProvisioningRequest(customProvReq) diff --git a/cluster-autoscaler/provisioningrequest/provreqclient/testutils.go b/cluster-autoscaler/provisioningrequest/provreqclient/testutils.go index 36230bf757df..5d10cc09b904 100644 --- a/cluster-autoscaler/provisioningrequest/provreqclient/testutils.go +++ b/cluster-autoscaler/provisioningrequest/provreqclient/testutils.go @@ -24,13 +24,13 @@ import ( apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/client/clientset/versioned/fake" "k8s.io/autoscaler/cluster-autoscaler/provisioningrequest/provreqwrapper" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" fake_kubernetes "k8s.io/client-go/kubernetes/fake" - v1 "k8s.io/client-go/listers/core/v1" + corev1 "k8s.io/client-go/listers/core/v1" klog "k8s.io/klog/v2" ) @@ -43,7 +43,7 @@ func NewFakeProvisioningRequestClient(ctx context.Context, t *testing.T, prs ... if pr == nil { continue } - if _, err := provReqClient.AutoscalingV1beta1().ProvisioningRequests(pr.Namespace).Create(ctx, pr.ProvisioningRequest, metav1.CreateOptions{}); err != nil { + if _, err := provReqClient.AutoscalingV1().ProvisioningRequests(pr.Namespace).Create(ctx, pr.ProvisioningRequest, metav1.CreateOptions{}); err != nil { t.Errorf("While adding a ProvisioningRequest: %s/%s to fake client, got error: %v", pr.Namespace, pr.Name, err) } for _, pd := range pr.PodTemplates { @@ -68,7 +68,7 @@ func NewFakeProvisioningRequestClient(ctx context.Context, t *testing.T, prs ... } // newFakePodTemplatesLister creates a fake lister for the Pod Templates in the cluster. -func newFakePodTemplatesLister(t *testing.T, client kubernetes.Interface, channel <-chan struct{}) (v1.PodTemplateLister, error) { +func newFakePodTemplatesLister(t *testing.T, client kubernetes.Interface, channel <-chan struct{}) (corev1.PodTemplateLister, error) { t.Helper() factory := informers.NewSharedInformerFactory(client, 1*time.Hour) podTemplLister := factory.Core().V1().PodTemplates().Lister() @@ -106,28 +106,28 @@ func ProvisioningRequestWrapperForTesting(namespace, name string) *provreqwrappe }, }, } - v1Beta1PR := &v1beta1.ProvisioningRequest{ + v1PR := &v1.ProvisioningRequest{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, }, - Spec: v1beta1.ProvisioningRequestSpec{ + Spec: v1.ProvisioningRequestSpec{ ProvisioningClassName: "test-class", - PodSets: []v1beta1.PodSet{ + PodSets: []v1.PodSet{ { Count: 1, - PodTemplateRef: v1beta1.Reference{ + PodTemplateRef: v1.Reference{ Name: podTemplates[0].Name, }, }, }, }, - Status: v1beta1.ProvisioningRequestStatus{ - ProvisioningClassDetails: map[string]v1beta1.Detail{}, + Status: v1.ProvisioningRequestStatus{ + ProvisioningClassDetails: map[string]v1.Detail{}, }, } - pr := provreqwrapper.NewProvisioningRequest(v1Beta1PR, podTemplates) + pr := provreqwrapper.NewProvisioningRequest(v1PR, podTemplates) return pr } @@ -139,13 +139,13 @@ func podTemplateNameFromName(name string) string { func (c *ProvisioningRequestClient) ProvisioningRequestNoCache(namespace, name string) (*provreqwrapper.ProvisioningRequest, error) { ctx, cancel := context.WithTimeout(context.Background(), provisioningRequestClientCallTimeout) defer cancel() - v1beta1, err := c.client.AutoscalingV1beta1().ProvisioningRequests(namespace).Get(ctx, name, metav1.GetOptions{}) + v1, err := c.client.AutoscalingV1().ProvisioningRequests(namespace).Get(ctx, name, metav1.GetOptions{}) if err != nil { return nil, err } - podTemplates, err := c.FetchPodTemplates(v1beta1) + podTemplates, err := c.FetchPodTemplates(v1) if err != nil { return nil, err } - return provreqwrapper.NewProvisioningRequest(v1beta1, podTemplates), nil + return provreqwrapper.NewProvisioningRequest(v1, podTemplates), nil } diff --git a/cluster-autoscaler/provisioningrequest/provreqwrapper/testutils.go b/cluster-autoscaler/provisioningrequest/provreqwrapper/testutils.go index 1954978e3f52..570525c3ec1b 100644 --- a/cluster-autoscaler/provisioningrequest/provreqwrapper/testutils.go +++ b/cluster-autoscaler/provisioningrequest/provreqwrapper/testutils.go @@ -23,8 +23,7 @@ import ( apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" ) // TestProvReqOptions is a helper struct to make constructing test ProvisioningRequest object easier. @@ -87,22 +86,22 @@ func BuildTestProvisioningRequest(namespace, name, cpu, memory, gpu string, podC } } return NewProvisioningRequest( - &v1beta1.ProvisioningRequest{ + &v1.ProvisioningRequest{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, - CreationTimestamp: v1.NewTime(creationTimestamp), + CreationTimestamp: metav1.NewTime(creationTimestamp), }, - Spec: v1beta1.ProvisioningRequestSpec{ + Spec: v1.ProvisioningRequestSpec{ ProvisioningClassName: class, - PodSets: []v1beta1.PodSet{ + PodSets: []v1.PodSet{ { - PodTemplateRef: v1beta1.Reference{Name: fmt.Sprintf("%s-template-name", name)}, + PodTemplateRef: v1.Reference{Name: fmt.Sprintf("%s-template-name", name)}, Count: podCount, }, }, }, - Status: v1beta1.ProvisioningRequestStatus{ + Status: v1.ProvisioningRequestStatus{ Conditions: []metav1.Condition{}, }, }, @@ -111,7 +110,7 @@ func BuildTestProvisioningRequest(namespace, name, cpu, memory, gpu string, podC ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%s-template-name", name), Namespace: namespace, - CreationTimestamp: v1.NewTime(creationTimestamp), + CreationTimestamp: metav1.NewTime(creationTimestamp), }, Template: apiv1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ diff --git a/cluster-autoscaler/provisioningrequest/provreqwrapper/wrapper.go b/cluster-autoscaler/provisioningrequest/provreqwrapper/wrapper.go index eb8141e88ad7..7ec6edd089c0 100644 --- a/cluster-autoscaler/provisioningrequest/provreqwrapper/wrapper.go +++ b/cluster-autoscaler/provisioningrequest/provreqwrapper/wrapper.go @@ -22,12 +22,12 @@ import ( apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" ) // ProvisioningRequest wrapper representation of the ProvisioningRequest type ProvisioningRequest struct { - *v1beta1.ProvisioningRequest + *v1.ProvisioningRequest PodTemplates []*apiv1.PodTemplate } @@ -39,8 +39,8 @@ type PodSet struct { PodTemplate apiv1.PodTemplateSpec } -// NewProvisioningRequest creates new ProvisioningRequest based on v1beta1 CR. -func NewProvisioningRequest(pr *v1beta1.ProvisioningRequest, podTemplates []*apiv1.PodTemplate) *ProvisioningRequest { +// NewProvisioningRequest creates new ProvisioningRequest based on v1 CR. +func NewProvisioningRequest(pr *v1.ProvisioningRequest, podTemplates []*apiv1.PodTemplate) *ProvisioningRequest { return &ProvisioningRequest{ ProvisioningRequest: pr, PodTemplates: podTemplates, @@ -69,7 +69,7 @@ func (pr *ProvisioningRequest) PodSets() ([]PodSet, error) { } // errMissingPodTemplates creates error that is passed when there are missing pod templates. -func errMissingPodTemplates(podSets []v1beta1.PodSet, podTemplates []*apiv1.PodTemplate) error { +func errMissingPodTemplates(podSets []v1.PodSet, podTemplates []*apiv1.PodTemplate) error { foundPodTemplates := map[string]struct{}{} for _, pt := range podTemplates { foundPodTemplates[pt.Name] = struct{}{} diff --git a/cluster-autoscaler/provisioningrequest/provreqwrapper/wrapper_test.go b/cluster-autoscaler/provisioningrequest/provreqwrapper/wrapper_test.go index e1ae3e0ff519..7d57af5d9253 100644 --- a/cluster-autoscaler/provisioningrequest/provreqwrapper/wrapper_test.go +++ b/cluster-autoscaler/provisioningrequest/provreqwrapper/wrapper_test.go @@ -24,7 +24,7 @@ import ( apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" ) func TestProvisioningRequestWrapper(t *testing.T) { @@ -74,7 +74,7 @@ func TestProvisioningRequestWrapper(t *testing.T) { }, }, } - v1Beta1PR := &v1beta1.ProvisioningRequest{ + v1PR := &v1.ProvisioningRequest{ TypeMeta: metav1.TypeMeta{ APIVersion: "beta-api", Kind: "beta-kind", @@ -85,24 +85,24 @@ func TestProvisioningRequestWrapper(t *testing.T) { CreationTimestamp: creationTimestamp, UID: types.UID("beta-uid"), }, - Spec: v1beta1.ProvisioningRequestSpec{ + Spec: v1.ProvisioningRequestSpec{ ProvisioningClassName: "queued-provisioning.gke.io", - PodSets: []v1beta1.PodSet{ + PodSets: []v1.PodSet{ { Count: 1, - PodTemplateRef: v1beta1.Reference{ + PodTemplateRef: v1.Reference{ Name: podTemplates[0].Name, }, }, }, }, - Status: v1beta1.ProvisioningRequestStatus{ + Status: v1.ProvisioningRequestStatus{ Conditions: conditions, - ProvisioningClassDetails: map[string]v1beta1.Detail{}, + ProvisioningClassDetails: map[string]v1.Detail{}, }, } - wrappedBetaPR := NewProvisioningRequest(v1Beta1PR, podTemplates) + wrappedBetaPR := NewProvisioningRequest(v1PR, podTemplates) // Check Name, Namespace and Creation accessors assert.Equal(t, "name-beta", wrappedBetaPR.Name) @@ -131,11 +131,11 @@ func TestProvisioningRequestWrapper(t *testing.T) { assert.Equal(t, podSets, betaPodSets) // Check the type accessors. - assert.Equal(t, v1Beta1PR, wrappedBetaPR.ProvisioningRequest) + assert.Equal(t, v1PR, wrappedBetaPR.ProvisioningRequest) assert.Equal(t, podTemplates, wrappedBetaPR.PodTemplates) // Check case where the Provisioning Request is missing Pod Templates. - wrappedBetaPRMissingPodTemplates := NewProvisioningRequest(v1Beta1PR, nil) + wrappedBetaPRMissingPodTemplates := NewProvisioningRequest(v1PR, nil) podSets, err := wrappedBetaPRMissingPodTemplates.PodSets() assert.Nil(t, podSets) assert.EqualError(t, err, "missing pod templates, 1 pod templates were referenced, 1 templates were missing: name-pod-template-beta") diff --git a/cluster-autoscaler/provisioningrequest/supported_classes.go b/cluster-autoscaler/provisioningrequest/supported_classes.go index cff7a7faa6b2..807e15bd7124 100644 --- a/cluster-autoscaler/provisioningrequest/supported_classes.go +++ b/cluster-autoscaler/provisioningrequest/supported_classes.go @@ -17,12 +17,12 @@ limitations under the License. package provisioningrequest import ( - "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1beta1" + "k8s.io/autoscaler/cluster-autoscaler/apis/provisioningrequest/autoscaling.x-k8s.io/v1" ) // SupportedProvisioningClasses is a set of ProvisioningRequest classes // supported by Cluster Autoscaler. var SupportedProvisioningClasses = map[string]bool{ - v1beta1.ProvisioningClassCheckCapacity: true, - v1beta1.ProvisioningClassBestEffortAtomicScaleUp: true, + v1.ProvisioningClassCheckCapacity: true, + v1.ProvisioningClassBestEffortAtomicScaleUp: true, }