vendor updates

This commit is contained in:
Serguei Bezverkhi
2018-03-06 17:33:18 -05:00
parent 4b3ebc171b
commit e9033989a0
5854 changed files with 248382 additions and 119809 deletions

View File

@ -0,0 +1,2 @@
Sorry, we do not accept changes directly against this repository. Please see
CONTRIBUTING.md for information on where and how to contribute instead.

7
vendor/k8s.io/apimachinery/CONTRIBUTING.md generated vendored Normal file
View File

@ -0,0 +1,7 @@
# Contributing guidelines
Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes.
This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/apimachinery](https://git.k8s.io/kubernetes/staging/src/k8s.io/apimachinery) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot).
Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/staging.md) for more information

View File

@ -1,254 +1,178 @@
{
"ImportPath": "k8s.io/apimachinery",
"GoVersion": "go1.9",
"GodepVersion": "v79",
"Packages": [
"./..."
],
"Deps": [
{
"ImportPath": "github.com/PuerkitoBio/purell",
"Rev": "8a290539e2e8629dbc4e6bad948158f790ec31f4"
},
{
"ImportPath": "github.com/PuerkitoBio/urlesc",
"Rev": "5bd2802263f21d8788851d5305584c82a5c75d7e"
},
{
"ImportPath": "github.com/davecgh/go-spew/spew",
"Rev": "782f4967f2dc4564575ca782fe2d04090b5faca8"
},
{
"ImportPath": "github.com/docker/spdystream",
"Rev": "449fdfce4d962303d702fec724ef0ad181c92528"
},
{
"ImportPath": "github.com/docker/spdystream/spdy",
"Rev": "449fdfce4d962303d702fec724ef0ad181c92528"
},
{
"ImportPath": "github.com/elazarl/goproxy",
"Rev": "c4fc26588b6ef8af07a191fcb6476387bdd46711"
},
{
"ImportPath": "github.com/emicklei/go-restful",
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
},
{
"ImportPath": "github.com/emicklei/go-restful/log",
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "944e07253867aacae43c04b2e6a239005443f33a"
},
{
"ImportPath": "github.com/ghodss/yaml",
"Rev": "73d445a93680fa1a78ae23a5839bad48f32ba1ee"
},
{
"ImportPath": "github.com/go-openapi/jsonpointer",
"Rev": "46af16f9f7b149af66e5d1bd010e3574dc06de98"
},
{
"ImportPath": "github.com/go-openapi/jsonreference",
"Rev": "13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272"
},
{
"ImportPath": "github.com/go-openapi/spec",
"Rev": "7abd5745472fff5eb3685386d5fb8bf38683154d"
},
{
"ImportPath": "github.com/go-openapi/swag",
"Rev": "f3f9494671f93fcff853e3c6e9e948b3eb71e590"
},
{
"ImportPath": "github.com/gogo/protobuf/proto",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/sortkeys",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/golang/glog",
"Rev": "44145f04b68cf362d9c4df2182967c2275eaefed"
},
{
"ImportPath": "github.com/golang/groupcache/lru",
"Rev": "02826c3e79038b59d737d3b1c0a1d937f71a4433"
},
{
"ImportPath": "github.com/golang/protobuf/proto",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/golang/protobuf/ptypes",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/golang/protobuf/ptypes/any",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/golang/protobuf/ptypes/duration",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/golang/protobuf/ptypes/timestamp",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/google/gofuzz",
"Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c"
},
{
"ImportPath": "github.com/googleapis/gnostic/OpenAPIv2",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
{
"ImportPath": "github.com/googleapis/gnostic/compiler",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
{
"ImportPath": "github.com/googleapis/gnostic/extensions",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
{
"ImportPath": "github.com/hashicorp/golang-lru",
"Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4"
},
{
"ImportPath": "github.com/hashicorp/golang-lru/simplelru",
"Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4"
},
{
"ImportPath": "github.com/json-iterator/go",
"Rev": "36b14963da70d11297d313183d7e6388c8510e1e"
},
{
"ImportPath": "github.com/mailru/easyjson/buffer",
"Rev": "2f5df55504ebc322e4d52d34df6a1f5b503bf26d"
},
{
"ImportPath": "github.com/mailru/easyjson/jlexer",
"Rev": "2f5df55504ebc322e4d52d34df6a1f5b503bf26d"
},
{
"ImportPath": "github.com/mailru/easyjson/jwriter",
"Rev": "2f5df55504ebc322e4d52d34df6a1f5b503bf26d"
},
{
"ImportPath": "github.com/mxk/go-flowrate/flowrate",
"Rev": "cca7078d478f8520f85629ad7c68962d31ed7682"
},
{
"ImportPath": "github.com/pborman/uuid",
"Rev": "ca53cad383cad2479bbba7f7a1a05797ec1386e4"
},
{
"ImportPath": "github.com/pmezard/go-difflib/difflib",
"Rev": "d8ed2627bdf02c080bf22230dbb337003b7aba2d"
},
{
"ImportPath": "github.com/spf13/pflag",
"Rev": "9ff6c6923cfffbcd502984b8e0c80539a94968b7"
},
{
"ImportPath": "github.com/stretchr/testify/assert",
"Rev": "f6abca593680b2315d2075e0f5e2a9751e3f431a"
},
{
"ImportPath": "github.com/stretchr/testify/require",
"Rev": "f6abca593680b2315d2075e0f5e2a9751e3f431a"
},
{
"ImportPath": "golang.org/x/net/html",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/html/atom",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/lex/httplex",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/websocket",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/text/cases",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/internal",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/internal/tag",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/language",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/runes",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/secure/precis",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/transform",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/unicode/bidi",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/unicode/norm",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/width",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "gopkg.in/inf.v0",
"Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4"
},
{
"ImportPath": "gopkg.in/yaml.v2",
"Rev": "53feefa2559fb8dfa8d81baad31be332c97d6c77"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/common",
"Rev": "39a7bf85c140f972372c2a0d1ee40adbf0c8bfe1"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "39a7bf85c140f972372c2a0d1ee40adbf0c8bfe1"
}
]
"ImportPath": "k8s.io/apimachinery",
"GoVersion": "go1.9",
"GodepVersion": "v79",
"Packages": [
"./..."
],
"Deps": [
{
"ImportPath": "github.com/davecgh/go-spew/spew",
"Rev": "782f4967f2dc4564575ca782fe2d04090b5faca8"
},
{
"ImportPath": "github.com/docker/spdystream",
"Rev": "449fdfce4d962303d702fec724ef0ad181c92528"
},
{
"ImportPath": "github.com/docker/spdystream/spdy",
"Rev": "449fdfce4d962303d702fec724ef0ad181c92528"
},
{
"ImportPath": "github.com/elazarl/goproxy",
"Rev": "c4fc26588b6ef8af07a191fcb6476387bdd46711"
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Rev": "944e07253867aacae43c04b2e6a239005443f33a"
},
{
"ImportPath": "github.com/ghodss/yaml",
"Rev": "73d445a93680fa1a78ae23a5839bad48f32ba1ee"
},
{
"ImportPath": "github.com/gogo/protobuf/proto",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/sortkeys",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/golang/glog",
"Rev": "44145f04b68cf362d9c4df2182967c2275eaefed"
},
{
"ImportPath": "github.com/golang/groupcache/lru",
"Rev": "02826c3e79038b59d737d3b1c0a1d937f71a4433"
},
{
"ImportPath": "github.com/golang/protobuf/proto",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/golang/protobuf/ptypes",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/golang/protobuf/ptypes/any",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/golang/protobuf/ptypes/duration",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/golang/protobuf/ptypes/timestamp",
"Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
},
{
"ImportPath": "github.com/google/gofuzz",
"Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c"
},
{
"ImportPath": "github.com/googleapis/gnostic/OpenAPIv2",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
{
"ImportPath": "github.com/googleapis/gnostic/compiler",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
{
"ImportPath": "github.com/googleapis/gnostic/extensions",
"Rev": "0c5108395e2debce0d731cf0287ddf7242066aba"
},
{
"ImportPath": "github.com/hashicorp/golang-lru",
"Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4"
},
{
"ImportPath": "github.com/hashicorp/golang-lru/simplelru",
"Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4"
},
{
"ImportPath": "github.com/json-iterator/go",
"Rev": "13f86432b882000a51c6e610c620974462691a97"
},
{
"ImportPath": "github.com/mxk/go-flowrate/flowrate",
"Rev": "cca7078d478f8520f85629ad7c68962d31ed7682"
},
{
"ImportPath": "github.com/pborman/uuid",
"Rev": "ca53cad383cad2479bbba7f7a1a05797ec1386e4"
},
{
"ImportPath": "github.com/pmezard/go-difflib/difflib",
"Rev": "d8ed2627bdf02c080bf22230dbb337003b7aba2d"
},
{
"ImportPath": "github.com/spf13/pflag",
"Rev": "4c012f6dcd9546820e378d0bdda4d8fc772cdfea"
},
{
"ImportPath": "github.com/stretchr/testify/assert",
"Rev": "f6abca593680b2315d2075e0f5e2a9751e3f431a"
},
{
"ImportPath": "github.com/stretchr/testify/require",
"Rev": "f6abca593680b2315d2075e0f5e2a9751e3f431a"
},
{
"ImportPath": "golang.org/x/net/html",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/html/atom",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/lex/httplex",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/net/websocket",
"Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f"
},
{
"ImportPath": "golang.org/x/text/secure/bidirule",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/transform",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/unicode/bidi",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "golang.org/x/text/unicode/norm",
"Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01"
},
{
"ImportPath": "gopkg.in/inf.v0",
"Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4"
},
{
"ImportPath": "gopkg.in/yaml.v2",
"Rev": "670d4cfef0544295bc27a114dbac37980d83185a"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "50ae88d24ede7b8bad68e23c805b5d3da5c8abaf"
}
]
}

2
vendor/k8s.io/apimachinery/Godeps/OWNERS generated vendored Normal file
View File

@ -0,0 +1,2 @@
approvers:
- dep-approvers

View File

@ -6,7 +6,7 @@ Scheme, typing, encoding, decoding, and conversion packages for Kubernetes and K
## Purpose
This library is a shared dependency for servers and clients to work with Kubernetes API infrastructure without direct
type dependencies. It's first comsumers are `k8s.io/kubernetes`, `k8s.io/client-go`, and `k8s.io/apiserver`.
type dependencies. Its first consumers are `k8s.io/kubernetes`, `k8s.io/client-go`, and `k8s.io/apiserver`.
## Compatibility
@ -25,5 +25,5 @@ Code changes are made in that location, merged into `k8s.io/kubernetes` and late
## Things you should *NOT* do
1. Add API types to this repo. This is for the machinery, not for the types.
2. Directly modify any files under `pkg` in this repo. Those are driven from `k8s.io/kuberenetes/staging/src/k8s.io/apimachinery`.
3. Expect compatibility. This repo is direct support of Kubernetes and the API isn't yet stable enough for API guarantees.
2. Directly modify any files under `pkg` in this repo. Those are driven from `k8s.io/kubernetes/staging/src/k8s.io/apimachinery`.
3. Expect compatibility. This repo is direct support of Kubernetes and the API isn't yet stable enough for API guarantees.

3
vendor/k8s.io/apimachinery/code-of-conduct.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# Kubernetes Community Code of Conduct
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)

View File

@ -1,66 +0,0 @@
#!/bin/bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# overall flow
# 1. make a clean gopath
# 2. godep restore based on k8s.io/kuberentes provided manifest
# 3. go get anything unlisted. This handles deps from k8s.io/*
# 4. remove old vendoring data
# 5. vendor packages we need
# 6. remove anything vendored from k8s.io/* from vendor, but not manifest.
# This allows go get to work and still be able to flatten dependencies.
# 6. copy new vendored packages and save them
set -o errexit
set -o nounset
set -o pipefail
goPath=$(mktemp -d "${TMPDIR:-/tmp/}$(basename 0).XXXXXXXXXXXX")
echo ${goPath}
export GOPATH=${goPath}
mkdir -p ${goPath}/src/k8s.io/apimachinery
cp -R . ${goPath}/src/k8s.io/apimachinery
pushd ${goPath}/src/k8s.io/apimachinery
rm -rf vendor || true
# restore what we have in our new manifest that we've sync
godep restore
# the manifest doesn't include any levels of k8s.io dependencies so load them using the go get
# assume you sync all the repos at the same time, the leves you get will be correct
go get -d ./... || true
# save the new levels of dependencies
rm -rf vendor || true
rm -rf Godeps || true
godep save ./...
popd
# remove the vendor dir we have and move the one we just made
rm -rf vendor || true
rm -rf Godeps || true
git rm -rf vendor || true
git rm -rf Godeps || true
mv ${goPath}/src/k8s.io/apimachinery/vendor .
mv ${goPath}/src/k8s.io/apimachinery/Godeps .
git add vendor
git add Godeps
git commit -m "sync: resync vendor folder"

View File

@ -1,65 +0,0 @@
#!/bin/bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# overall flow
# 1. fetch the current level of k8s.io/kubernetes
# 2. check out the k8s.io/kubernetes HEAD into a separate branch
# 3. rewrite the history on that branch to *only* include staging/src/k8s.io/apimachinery
# 4. locate all commits between the last time we sync'ed and now
# 5. switch back to the starting branch
# 6. for each commit, cherry-pick it (which will keep authorship) into current branch
# 7. update metadata files indicating which commits we've sync'ed to
set -e
ROOT=$(dirname "${BASH_SOURCE}")/..
dir=$(mktemp -d "${TMPDIR:-/tmp/}$(basename 0).XXXXXXXXXXXX")
git remote add upstream-kube git@github.com:kubernetes/kubernetes.git || true
git fetch upstream-kube
currBranch=$(git rev-parse --abbrev-ref HEAD)
previousKubeSHA=$(cat kubernetes-sha)
previousBranchSHA=$(cat filter-branch-sha)
git branch -D kube-sync || true
git checkout upstream-kube/master -b kube-sync
git reset --hard upstream-kube/master
newKubeSHA=$(git log --oneline --format='%H' kube-sync -1)
# this command rewrite git history to *only* include staging/src/k8s.io/apimachinery
git filter-branch -f --subdirectory-filter staging/src/k8s.io/apimachinery HEAD
newBranchSHA=$(git log --oneline --format='%H' kube-sync -1)
git log --no-merges --format='%H' --reverse ${previousBranchSHA}..HEAD > ${dir}/commits
git checkout ${currBranch}
while read commitSHA; do
echo "working ${commitSHA}"
git cherry-pick ${commitSHA}
done <${dir}/commits
# update the vendored godeps
${ROOT}/hack/godep-deps.sh
# track the k8s.io/kubernetes commit SHA so we can always determine which level of kube this repo matches
# track the filtered branch commit SHA so that we can determine which commits need to be picked
echo ${newKubeSHA} > kubernetes-sha
echo ${newBranchSHA} > filter-branch-sha
git commit -m "sync(k8s.io/kubernetes): ${newKubeSHA}" -- kubernetes-sha filter-branch-sha

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["errors_test.go"],
importpath = "k8s.io/apimachinery/pkg/api/errors",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",

View File

@ -16,7 +16,6 @@ reviewers:
- janetkuo
- tallclair
- eparis
- timothysc
- dims
- hongchaodeng
- krousey

View File

@ -352,12 +352,23 @@ func NewGenericServerResponse(code int, verb string, qualifiedResource schema.Gr
reason = metav1.StatusReasonForbidden
// the server message has details about who is trying to perform what action. Keep its message.
message = serverMessage
case http.StatusNotAcceptable:
reason = metav1.StatusReasonNotAcceptable
// the server message has details about what types are acceptable
message = serverMessage
case http.StatusUnsupportedMediaType:
reason = metav1.StatusReasonUnsupportedMediaType
// the server message has details about what types are acceptable
message = serverMessage
case http.StatusMethodNotAllowed:
reason = metav1.StatusReasonMethodNotAllowed
message = "the server does not allow this method on the requested resource"
case http.StatusUnprocessableEntity:
reason = metav1.StatusReasonInvalid
message = "the server rejected our request due to an error in our request"
case http.StatusServiceUnavailable:
reason = metav1.StatusReasonServiceUnavailable
message = "the server is currently unable to handle the request"
case http.StatusGatewayTimeout:
reason = metav1.StatusReasonTimeout
message = "the server was unable to return a response in the time allotted, but may still be processing the request"
@ -434,6 +445,16 @@ func IsResourceExpired(err error) bool {
return ReasonForError(err) == metav1.StatusReasonExpired
}
// IsNotAcceptable determines if err is an error which indicates that the request failed due to an invalid Accept header
func IsNotAcceptable(err error) bool {
return ReasonForError(err) == metav1.StatusReasonNotAcceptable
}
// IsUnsupportedMediaType determines if err is an error which indicates that the request failed due to an invalid Content-Type header
func IsUnsupportedMediaType(err error) bool {
return ReasonForError(err) == metav1.StatusReasonUnsupportedMediaType
}
// IsMethodNotSupported determines if the err is an error which indicates the provided action could not
// be performed because it is not supported by the server.
func IsMethodNotSupported(err error) bool {

View File

@ -14,12 +14,11 @@ go_test(
"priority_test.go",
"restmapper_test.go",
],
importpath = "k8s.io/apimachinery/pkg/api/meta",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/google/gofuzz:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/diff:go_default_library",
@ -46,12 +45,13 @@ go_library(
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
],
)
@ -64,6 +64,9 @@ filegroup(
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
srcs = [
":package-srcs",
"//staging/src/k8s.io/apimachinery/pkg/api/meta/table:all-srcs",
],
tags = ["automanaged"],
)

View File

@ -20,6 +20,7 @@ import (
"fmt"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
)
// AmbiguousResourceError is returned if the RESTMapper finds multiple matches for a resource
@ -85,11 +86,26 @@ func (e *NoResourceMatchError) Error() string {
// NoKindMatchError is returned if the RESTMapper can't find any match for a kind
type NoKindMatchError struct {
PartialKind schema.GroupVersionKind
// GroupKind is the API group and kind that was searched
GroupKind schema.GroupKind
// SearchedVersions is the optional list of versions the search was restricted to
SearchedVersions []string
}
func (e *NoKindMatchError) Error() string {
return fmt.Sprintf("no matches for %v", e.PartialKind)
searchedVersions := sets.NewString()
for _, v := range e.SearchedVersions {
searchedVersions.Insert(schema.GroupVersion{Group: e.GroupKind.Group, Version: v}.String())
}
switch len(searchedVersions) {
case 0:
return fmt.Sprintf("no matches for kind %q in group %q", e.GroupKind.Kind, e.GroupKind.Group)
case 1:
return fmt.Sprintf("no matches for kind %q in version %q", e.GroupKind.Kind, searchedVersions.List()[0])
default:
return fmt.Sprintf("no matches for kind %q in versions %q", e.GroupKind.Kind, searchedVersions.List())
}
}
func IsNoMatchError(err error) bool {

View File

@ -23,7 +23,7 @@ import (
"github.com/golang/glog"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1alpha1 "k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
@ -118,12 +118,12 @@ func Accessor(obj interface{}) (metav1.Object, error) {
// AsPartialObjectMetadata takes the metav1 interface and returns a partial object.
// TODO: consider making this solely a conversion action.
func AsPartialObjectMetadata(m metav1.Object) *metav1alpha1.PartialObjectMetadata {
func AsPartialObjectMetadata(m metav1.Object) *metav1beta1.PartialObjectMetadata {
switch t := m.(type) {
case *metav1.ObjectMeta:
return &metav1alpha1.PartialObjectMetadata{ObjectMeta: *t}
return &metav1beta1.PartialObjectMetadata{ObjectMeta: *t}
default:
return &metav1alpha1.PartialObjectMetadata{
return &metav1beta1.PartialObjectMetadata{
ObjectMeta: metav1.ObjectMeta{
Name: m.GetName(),
GenerateName: m.GetGenerateName(),

View File

@ -22,7 +22,7 @@ import (
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1alpha1 "k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/apimachinery/pkg/util/diff"
fuzz "github.com/google/gofuzz"
@ -41,7 +41,7 @@ func TestAsPartialObjectMetadata(t *testing.T) {
}
for i := 0; i < 100; i++ {
m := &metav1alpha1.PartialObjectMetadata{}
m := &metav1beta1.PartialObjectMetadata{}
f.Fuzz(&m.ObjectMeta)
partial := AsPartialObjectMetadata(m)
if !reflect.DeepEqual(&partial.ObjectMeta, &m.ObjectMeta) {

View File

@ -179,7 +179,7 @@ func (m MultiRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*
if len(errors) > 0 {
return nil, utilerrors.NewAggregate(errors)
}
return nil, &NoKindMatchError{PartialKind: gk.WithVersion("")}
return nil, &NoKindMatchError{GroupKind: gk, SearchedVersions: versions}
}
// RESTMappings returns all possible RESTMappings for the provided group kind, or an error
@ -204,7 +204,7 @@ func (m MultiRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (
return nil, utilerrors.NewAggregate(errors)
}
if len(allMappings) == 0 {
return nil, &NoKindMatchError{PartialKind: gk.WithVersion("")}
return nil, &NoKindMatchError{GroupKind: gk, SearchedVersions: versions}
}
return allMappings, nil
}

View File

@ -261,42 +261,78 @@ func TestMultiRESTMapperRESTMappings(t *testing.T) {
tcs := []struct {
name string
mapper MultiRESTMapper
input schema.GroupKind
result []*RESTMapping
err error
mapper MultiRESTMapper
groupKind schema.GroupKind
versions []string
result []*RESTMapping
err error
}{
{
name: "empty",
mapper: MultiRESTMapper{},
input: schema.GroupKind{Kind: "Foo"},
result: nil,
err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "Foo"}},
name: "empty with no versions",
mapper: MultiRESTMapper{},
groupKind: schema.GroupKind{Kind: "Foo"},
result: nil,
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
},
{
name: "ignore not found",
mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "IGNORE_THIS"}}}},
input: schema.GroupKind{Kind: "Foo"},
result: nil,
err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "Foo"}},
name: "empty with one version",
mapper: MultiRESTMapper{},
groupKind: schema.GroupKind{Kind: "Foo"},
versions: []string{"v1beta"},
result: nil,
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta"}},
},
{
name: "accept first failure",
mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{mappings: []*RESTMapping{mapping1}}},
input: schema.GroupKind{Kind: "Foo"},
result: nil,
err: errors.New("fail on this"),
name: "empty with multi(two) vesions",
mapper: MultiRESTMapper{},
groupKind: schema.GroupKind{Kind: "Foo"},
versions: []string{"v1beta", "v2"},
result: nil,
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta", "v2"}},
},
{
name: "return both",
mapper: MultiRESTMapper{fixedRESTMapper{mappings: []*RESTMapping{mapping1}}, fixedRESTMapper{mappings: []*RESTMapping{mapping2}}},
input: schema.GroupKind{Kind: "Foo"},
result: []*RESTMapping{mapping1, mapping2},
name: "ignore not found with kind not exist",
mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "IGNORE_THIS"}}}},
groupKind: schema.GroupKind{Kind: "Foo"},
versions: nil,
result: nil,
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
},
{
name: "ignore not found with version not exist",
mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1"}}}},
groupKind: schema.GroupKind{Kind: "Foo"},
versions: []string{"v1beta"},
result: nil,
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta"}},
},
{
name: "ignore not found with multi versions not exist",
mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1"}}}},
groupKind: schema.GroupKind{Kind: "Foo"},
versions: []string{"v1beta", "v2"},
result: nil,
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta", "v2"}},
},
{
name: "accept first failure",
mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{mappings: []*RESTMapping{mapping1}}},
groupKind: schema.GroupKind{Kind: "Foo"},
versions: []string{"v1beta"},
result: nil,
err: errors.New("fail on this"),
},
{
name: "return both",
mapper: MultiRESTMapper{fixedRESTMapper{mappings: []*RESTMapping{mapping1}}, fixedRESTMapper{mappings: []*RESTMapping{mapping2}}},
groupKind: schema.GroupKind{Kind: "Foo"},
versions: []string{"v1beta"},
result: []*RESTMapping{mapping1, mapping2},
},
}
for _, tc := range tcs {
actualResult, actualErr := tc.mapper.RESTMappings(tc.input)
actualResult, actualErr := tc.mapper.RESTMappings(tc.groupKind, tc.versions...)
if e, a := tc.result, actualResult; !reflect.DeepEqual(e, a) {
t.Errorf("%s: expected %v, got %v", tc.name, e, a)
}

View File

@ -153,7 +153,7 @@ func kindMatches(pattern schema.GroupVersionKind, kind schema.GroupVersionKind)
}
func (m PriorityRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (mapping *RESTMapping, err error) {
mappings, err := m.Delegate.RESTMappings(gk)
mappings, err := m.Delegate.RESTMappings(gk, versions...)
if err != nil {
return nil, err
}

View File

@ -234,13 +234,13 @@ func TestPriorityRESTMapperRESTMapping(t *testing.T) {
name: "empty",
mapper: PriorityRESTMapper{Delegate: MultiRESTMapper{}},
input: schema.GroupKind{Kind: "Foo"},
err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "Foo"}},
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
},
{
name: "ignore not found",
mapper: PriorityRESTMapper{Delegate: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "IGNORE_THIS"}}}}},
mapper: PriorityRESTMapper{Delegate: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "IGNORE_THIS"}}}}},
input: schema.GroupKind{Kind: "Foo"},
err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "Foo"}},
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
},
{
name: "accept first failure",

View File

@ -472,7 +472,7 @@ func (m *DefaultRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string)
return nil, err
}
if len(mappings) == 0 {
return nil, &NoKindMatchError{PartialKind: gk.WithVersion("")}
return nil, &NoKindMatchError{GroupKind: gk, SearchedVersions: versions}
}
// since we rely on RESTMappings method
// take the first match and return to the caller
@ -510,7 +510,7 @@ func (m *DefaultRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string
}
if len(potentialGVK) == 0 {
return nil, &NoKindMatchError{PartialKind: gk.WithVersion("")}
return nil, &NoKindMatchError{GroupKind: gk, SearchedVersions: versions}
}
for _, gvk := range potentialGVK {

View File

@ -507,7 +507,7 @@ func TestRESTMapperResourceSingularizer(t *testing.T) {
{Kind: "lowercase", Plural: "lowercases", Singular: "lowercase"},
// TODO this test is broken. This updates to reflect actual behavior. Kinds are expected to be singular
// old (incorrect), coment: Don't add extra s if the original object is already plural
// old (incorrect), comment: Don't add extra s if the original object is already plural
{Kind: "lowercases", Plural: "lowercaseses", Singular: "lowercases"},
}
for i, testCase := range testCases {

29
vendor/k8s.io/apimachinery/pkg/api/meta/table/BUILD generated vendored Normal file
View File

@ -0,0 +1,29 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["table.go"],
importpath = "k8s.io/apimachinery/pkg/api/meta/table",
visibility = ["//visibility:public"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/duration:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

71
vendor/k8s.io/apimachinery/pkg/api/meta/table/table.go generated vendored Normal file
View File

@ -0,0 +1,71 @@
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package table
import (
"time"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/duration"
)
// MetaToTableRow converts a list or object into one or more table rows. The provided rowFn is invoked for
// each accessed item, with name and age being passed to each.
func MetaToTableRow(obj runtime.Object, rowFn func(obj runtime.Object, m metav1.Object, name, age string) ([]interface{}, error)) ([]metav1beta1.TableRow, error) {
if meta.IsListType(obj) {
rows := make([]metav1beta1.TableRow, 0, 16)
err := meta.EachListItem(obj, func(obj runtime.Object) error {
nestedRows, err := MetaToTableRow(obj, rowFn)
if err != nil {
return err
}
rows = append(rows, nestedRows...)
return nil
})
if err != nil {
return nil, err
}
return rows, nil
}
rows := make([]metav1beta1.TableRow, 0, 1)
m, err := meta.Accessor(obj)
if err != nil {
return nil, err
}
row := metav1beta1.TableRow{
Object: runtime.RawExtension{Object: obj},
}
row.Cells, err = rowFn(obj, m, m.GetName(), translateTimestamp(m.GetCreationTimestamp()))
if err != nil {
return nil, err
}
rows = append(rows, row)
return rows, nil
}
// translateTimestamp returns the elapsed time since timestamp in
// human-readable approximation.
func translateTimestamp(timestamp metav1.Time) string {
if timestamp.IsZero() {
return "<unknown>"
}
return duration.ShortHumanDuration(time.Now().Sub(timestamp.Time))
}

View File

@ -15,8 +15,7 @@ go_test(
"quantity_test.go",
"scale_int_test.go",
],
importpath = "k8s.io/apimachinery/pkg/api/resource",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/google/gofuzz:go_default_library",
"//vendor/github.com/spf13/pflag:go_default_library",
@ -38,18 +37,15 @@ go_library(
],
importpath = "k8s.io/apimachinery/pkg/api/resource",
deps = [
"//vendor/github.com/go-openapi/spec:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/spf13/pflag:go_default_library",
"//vendor/gopkg.in/inf.v0:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
],
)
go_test(
name = "go_default_xtest",
srcs = ["quantity_example_test.go"],
importpath = "k8s.io/apimachinery/pkg/api/resource_test",
deps = ["//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library"],
)

View File

@ -9,7 +9,6 @@ reviewers:
- janetkuo
- tallclair
- eparis
- timothysc
- jbeda
- xiang90
- mbohlool

View File

@ -27,9 +27,7 @@ import (
flag "github.com/spf13/pflag"
"github.com/go-openapi/spec"
inf "gopkg.in/inf.v0"
openapi "k8s.io/kube-openapi/pkg/common"
)
// Quantity is a fixed-point representation of a number.
@ -399,17 +397,15 @@ func (q Quantity) DeepCopy() Quantity {
return q
}
// OpenAPIDefinition returns openAPI definition for this type.
func (_ Quantity) OpenAPIDefinition() openapi.OpenAPIDefinition {
return openapi.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
}
}
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
func (_ Quantity) OpenAPISchemaType() []string { return []string{"string"} }
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
func (_ Quantity) OpenAPISchemaFormat() string { return "" }
// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity).
//

View File

@ -45,7 +45,7 @@ func TestScaledValueInternal(t *testing.T) {
{big.NewInt(1), 3, 0, 1},
// large scaled value does not lose precision
{big.NewInt(0).Sub(maxInt64, bigOne), 1, 0, (math.MaxInt64-1)/10 + 1},
// large intermidiate result.
// large intermediate result.
{big.NewInt(1).Exp(big.NewInt(10), big.NewInt(100), nil), 100, 0, 1},
// scale up

View File

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
// Code generated by deepcopy-gen. DO NOT EDIT.
package resource

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["valuefuzz_test.go"],
importpath = "k8s.io/apimachinery/pkg/api/testing/fuzzer",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View File

@ -277,12 +277,6 @@ func roundTrip(t *testing.T, scheme *runtime.Scheme, codec runtime.Codec, object
return
}
// catch deepcopy errors early
if !apiequality.Semantic.DeepEqual(original, object) {
t.Errorf("%v: DeepCopy did not lead to equal object, diff: %v", name, diff.ObjectReflectDiff(original, object))
return
}
// encode (serialize) the deep copy using the provided codec
data, err := runtime.Encode(codec, object)
if err != nil {

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["objectmeta_test.go"],
importpath = "k8s.io/apimachinery/pkg/api/validation",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["name_test.go"],
importpath = "k8s.io/apimachinery/pkg/api/validation/path",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["types_test.go"],
importpath = "k8s.io/apimachinery/pkg/apimachinery",
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library"],
)

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["announced_test.go"],
importpath = "k8s.io/apimachinery/pkg/apimachinery/announced",
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library"],
)

View File

@ -35,7 +35,7 @@ import (
//
// (Right now APIRegistrationManager has separate 'registration' and 'enabled'
// concepts-- APIGroupFactory is going to take over the former function;
// they will overlap untill the refactoring is finished.)
// they will overlap until the refactoring is finished.)
//
// The key is the group name. After initialization, this should be treated as
// read-only. It is implemented as a map from group name to group factory, and

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["registered_test.go"],
importpath = "k8s.io/apimachinery/pkg/apimachinery/registered",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apimachinery:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -15,7 +15,7 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/api/testing:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/testing/fuzzer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",

View File

@ -29,7 +29,7 @@ import (
apitesting "k8s.io/apimachinery/pkg/api/testing"
"k8s.io/apimachinery/pkg/api/testing/fuzzer"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1alpha1 "k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/types"
@ -221,7 +221,7 @@ func v1FuzzerFuncs(codecs runtimeserializer.CodecFactory) []interface{} {
if j.MatchExpressions != nil {
// NB: the label selector parser code sorts match expressions by key, and sorts the values,
// so we need to make sure ours are sorted as well here to preserve round-trip comparision.
// so we need to make sure ours are sorted as well here to preserve round-trip comparison.
// In practice, not sorting doesn't hurt anything...
for i := range j.MatchExpressions {
@ -252,7 +252,7 @@ func v1FuzzerFuncs(codecs runtimeserializer.CodecFactory) []interface{} {
func v1alpha1FuzzerFuncs(codecs runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
func(r *metav1alpha1.TableRow, c fuzz.Continue) {
func(r *metav1beta1.TableRow, c fuzz.Continue) {
c.Fuzz(&r.Object)
c.Fuzz(&r.Conditions)
if len(r.Conditions) == 0 {

View File

@ -12,8 +12,7 @@ go_test(
"register_test.go",
"roundtrip_test.go",
],
importpath = "k8s.io/apimachinery/pkg/apis/meta/internalversion",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/api/testing/roundtrip:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/fuzzer:go_default_library",
@ -35,7 +34,7 @@ go_library(
importpath = "k8s.io/apimachinery/pkg/apis/meta/internalversion",
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",

View File

@ -15,5 +15,6 @@ limitations under the License.
*/
// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=k8s.io/apimachinery/pkg/apis/meta/v1
package internalversion

View File

@ -18,7 +18,7 @@ package internalversion
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1alpha1 "k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
@ -79,16 +79,16 @@ func addToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
&metav1.DeleteOptions{},
)
scheme.AddKnownTypes(SchemeGroupVersion,
&metav1alpha1.Table{},
&metav1alpha1.TableOptions{},
&metav1alpha1.PartialObjectMetadata{},
&metav1alpha1.PartialObjectMetadataList{},
&metav1beta1.Table{},
&metav1beta1.TableOptions{},
&metav1beta1.PartialObjectMetadata{},
&metav1beta1.PartialObjectMetadataList{},
)
scheme.AddKnownTypes(metav1alpha1.SchemeGroupVersion,
&metav1alpha1.Table{},
&metav1alpha1.TableOptions{},
&metav1alpha1.PartialObjectMetadata{},
&metav1alpha1.PartialObjectMetadataList{},
scheme.AddKnownTypes(metav1beta1.SchemeGroupVersion,
&metav1beta1.Table{},
&metav1beta1.TableOptions{},
&metav1beta1.PartialObjectMetadata{},
&metav1beta1.PartialObjectMetadataList{},
)
// Allow delete options to be decoded across all version in this scheme (we may want to be more clever than this)
scheme.AddUnversionedTypes(SchemeGroupVersion, &metav1.DeleteOptions{})

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated
/*
Copyright 2017 The Kubernetes Authors.
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -16,15 +16,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by conversion-gen. Do not edit it manually!
// Code generated by conversion-gen. DO NOT EDIT.
package internalversion
import (
unsafe "unsafe"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
unsafe "unsafe"
)
func init() {
@ -53,7 +54,7 @@ func autoConvert_internalversion_List_To_v1_List(in *List, out *v1.List, s conve
}
}
} else {
out.Items = make([]runtime.RawExtension, 0)
out.Items = nil
}
return nil
}
@ -95,6 +96,8 @@ func autoConvert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions,
out.Watch = in.Watch
out.ResourceVersion = in.ResourceVersion
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
out.Limit = in.Limit
out.Continue = in.Continue
return nil
}
@ -109,5 +112,7 @@ func autoConvert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOption
out.Watch = in.Watch
out.ResourceVersion = in.ResourceVersion
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
out.Limit = in.Limit
out.Continue = in.Continue
return nil
}

View File

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
// Code generated by deepcopy-gen. DO NOT EDIT.
package internalversion
@ -57,9 +57,8 @@ func (in *List) DeepCopy() *List {
func (in *List) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -102,7 +101,6 @@ func (in *ListOptions) DeepCopy() *ListOptions {
func (in *ListOptions) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}

View File

@ -18,8 +18,7 @@ go_test(
"time_test.go",
"types_test.go",
],
importpath = "k8s.io/apimachinery/pkg/apis/meta/v1",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/ghodss/yaml:go_default_library",
"//vendor/github.com/json-iterator/go:go_default_library",
@ -53,7 +52,6 @@ go_library(
],
importpath = "k8s.io/apimachinery/pkg/apis/meta/v1",
deps = [
"//vendor/github.com/go-openapi/spec:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/gogo/protobuf/sortkeys:go_default_library",
"//vendor/github.com/google/gofuzz:go_default_library",
@ -67,7 +65,6 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
],
)
@ -97,7 +94,6 @@ filegroup(
go_test(
name = "go_default_xtest",
srcs = ["conversion_test.go"],
importpath = "k8s.io/apimachinery/pkg/apis/meta/v1_test",
deps = [
"//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

View File

@ -16,7 +16,6 @@ reviewers:
- janetkuo
- justinsb
- ncdc
- timothysc
- soltysh
- dims
- madhusudancs

View File

@ -65,6 +65,9 @@ func AddConversionFuncs(scheme *runtime.Scheme) error {
Convert_Pointer_int32_To_int32,
Convert_int32_To_Pointer_int32,
Convert_Pointer_int64_To_int64,
Convert_int64_To_Pointer_int64,
Convert_Pointer_float64_To_float64,
Convert_float64_To_Pointer_float64,
@ -105,6 +108,21 @@ func Convert_int32_To_Pointer_int32(in *int32, out **int32, s conversion.Scope)
return nil
}
func Convert_Pointer_int64_To_int64(in **int64, out *int64, s conversion.Scope) error {
if *in == nil {
*out = 0
return nil
}
*out = int64(**in)
return nil
}
func Convert_int64_To_Pointer_int64(in *int64, out **int64, s conversion.Scope) error {
temp := int64(*in)
*out = &temp
return nil
}
func Convert_Pointer_int64_To_int(in **int64, out *int, s conversion.Scope) error {
if *in == nil {
*out = 0

View File

@ -375,6 +375,7 @@ message ListOptions {
optional string resourceVersion = 4;
// Timeout for the list/watch call.
// This limits the duration of the call, regardless of any activity or inactivity.
// +optional
optional int64 timeoutSeconds = 5;

View File

@ -47,7 +47,7 @@ func TestGroupVersionUnmarshalJSON(t *testing.T) {
t.Errorf("JSON codec failed to unmarshal input '%s': expected %+v, got %+v", c.input, c.expect, result.GV)
}
// test the json-iterator codec
if err := jsoniter.ConfigFastest.Unmarshal(c.input, &result); err != nil {
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(c.input, &result); err != nil {
t.Errorf("json-iterator codec failed to unmarshal input '%v': %v", c.input, err)
}
if !reflect.DeepEqual(result.GV, c.expect) {

View File

@ -25,34 +25,14 @@ func CloneSelectorAndAddLabel(selector *LabelSelector, labelKey, labelValue stri
}
// Clone.
newSelector := new(LabelSelector)
newSelector := selector.DeepCopy()
// TODO(madhusudancs): Check if you can use deepCopy_extensions_LabelSelector here.
newSelector.MatchLabels = make(map[string]string)
if selector.MatchLabels != nil {
for key, val := range selector.MatchLabels {
newSelector.MatchLabels[key] = val
}
if newSelector.MatchLabels == nil {
newSelector.MatchLabels = make(map[string]string)
}
newSelector.MatchLabels[labelKey] = labelValue
if selector.MatchExpressions != nil {
newMExps := make([]LabelSelectorRequirement, len(selector.MatchExpressions))
for i, me := range selector.MatchExpressions {
newMExps[i].Key = me.Key
newMExps[i].Operator = me.Operator
if me.Values != nil {
newMExps[i].Values = make([]string, len(me.Values))
copy(newMExps[i].Values, me.Values)
} else {
newMExps[i].Values = nil
}
}
newSelector.MatchExpressions = newMExps
} else {
newSelector.MatchExpressions = nil
}
return newSelector
}

View File

@ -27,6 +27,9 @@ func TestCloneSelectorAndAddLabel(t *testing.T) {
"foo2": "bar2",
"foo3": "bar3",
}
matchExpressions := []LabelSelectorRequirement{
{Key: "foo", Operator: LabelSelectorOpIn, Values: []string{"foo"}},
}
cases := []struct {
labels map[string]string
@ -60,8 +63,8 @@ func TestCloneSelectorAndAddLabel(t *testing.T) {
}
for _, tc := range cases {
ls_in := LabelSelector{MatchLabels: tc.labels}
ls_out := LabelSelector{MatchLabels: tc.want}
ls_in := LabelSelector{MatchLabels: tc.labels, MatchExpressions: matchExpressions}
ls_out := LabelSelector{MatchLabels: tc.want, MatchExpressions: matchExpressions}
got := CloneSelectorAndAddLabel(&ls_in, tc.labelKey, tc.labelValue)
if !reflect.DeepEqual(got, &ls_out) {

View File

@ -20,9 +20,6 @@ import (
"encoding/json"
"time"
openapi "k8s.io/kube-openapi/pkg/common"
"github.com/go-openapi/spec"
"github.com/google/gofuzz"
)
@ -149,16 +146,15 @@ func (t MicroTime) MarshalJSON() ([]byte, error) {
return json.Marshal(t.UTC().Format(RFC3339Micro))
}
func (_ MicroTime) OpenAPIDefinition() openapi.OpenAPIDefinition {
return openapi.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "date-time",
},
},
}
}
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
func (_ MicroTime) OpenAPISchemaType() []string { return []string{"string"} }
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
func (_ MicroTime) OpenAPISchemaFormat() string { return "date-time" }
// MarshalQueryParameter converts to a URL query parameter value
func (t MicroTime) MarshalQueryParameter() (string, error) {

View File

@ -20,9 +20,6 @@ import (
"encoding/json"
"time"
openapi "k8s.io/kube-openapi/pkg/common"
"github.com/go-openapi/spec"
"github.com/google/gofuzz"
)
@ -151,16 +148,15 @@ func (t Time) MarshalJSON() ([]byte, error) {
return json.Marshal(t.UTC().Format(time.RFC3339))
}
func (_ Time) OpenAPIDefinition() openapi.OpenAPIDefinition {
return openapi.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "date-time",
},
},
}
}
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
func (_ Time) OpenAPISchemaType() []string { return []string{"string"} }
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
func (_ Time) OpenAPISchemaFormat() string { return "date-time" }
// MarshalQueryParameter converts to a URL query parameter value
func (t Time) MarshalQueryParameter() (string, error) {

View File

@ -342,6 +342,7 @@ type ListOptions struct {
// +optional
ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,4,opt,name=resourceVersion"`
// Timeout for the list/watch call.
// This limits the duration of the call, regardless of any activity or inactivity.
// +optional
TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty" protobuf:"varint,5,opt,name=timeoutSeconds"`
@ -651,6 +652,18 @@ const (
// can only be created. API calls that return MethodNotAllowed can never succeed.
StatusReasonMethodNotAllowed StatusReason = "MethodNotAllowed"
// StatusReasonNotAcceptable means that the accept types indicated by the client were not acceptable
// to the server - for instance, attempting to receive protobuf for a resource that supports only json and yaml.
// API calls that return NotAcceptable can never succeed.
// Status code 406
StatusReasonNotAcceptable StatusReason = "NotAcceptable"
// StatusReasonUnsupportedMediaType means that the content type sent by the client is not acceptable
// to the server - for instance, attempting to send protobuf for a resource that supports only json and yaml.
// API calls that return UnsupportedMediaType can never succeed.
// Status code 415
StatusReasonUnsupportedMediaType StatusReason = "UnsupportedMediaType"
// StatusReasonInternalError indicates that an internal error occurred, it is unexpected
// and the outcome of the call is unknown.
// Details (optional):

View File

@ -195,7 +195,7 @@ var map_ListOptions = map[string]string{
"includeUninitialized": "If true, partially initialized resources are included in the response.",
"watch": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"resourceVersion": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.",
"timeoutSeconds": "Timeout for the list/watch call.",
"timeoutSeconds": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
"limit": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
"continue": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
}

View File

@ -58,7 +58,7 @@ func TestVerbsUgorjiUnmarshalJSON(t *testing.T) {
for i, c := range cases {
var result APIResource
if err := jsoniter.ConfigFastest.Unmarshal([]byte(c.input), &result); err != nil {
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal([]byte(c.input), &result); err != nil {
t.Errorf("[%d] Failed to unmarshal input '%v': %v", i, c.input, err)
}
if !reflect.DeepEqual(result, c.result) {

View File

@ -12,8 +12,7 @@ go_test(
"helpers_test.go",
"unstructured_list_test.go",
],
importpath = "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/stretchr/testify/assert:go_default_library",
"//vendor/github.com/stretchr/testify/require:go_default_library",

View File

@ -31,163 +31,181 @@ import (
)
// NestedFieldCopy returns a deep copy of the value of a nested field.
// false is returned if the value is missing.
// nil, true is returned for a nil field.
func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{}, bool) {
val, ok := nestedFieldNoCopy(obj, fields...)
if !ok {
return nil, false
// Returns false if the value is missing.
// No error is returned for a nil field.
func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
val, found, err := nestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
return runtime.DeepCopyJSONValue(val), true
return runtime.DeepCopyJSONValue(val), true, nil
}
func nestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool) {
func nestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
var val interface{} = obj
for _, field := range fields {
for i, field := range fields {
if m, ok := val.(map[string]interface{}); ok {
val, ok = m[field]
if !ok {
return nil, false
return nil, false, nil
}
} else {
// Expected map[string]interface{}, got something else
return nil, false
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected map[string]interface{}", jsonPath(fields[:i+1]), val, val)
}
}
return val, true
return val, true, nil
}
// NestedString returns the string value of a nested field.
// Returns false if value is not found or is not a string.
func NestedString(obj map[string]interface{}, fields ...string) (string, bool) {
val, ok := nestedFieldNoCopy(obj, fields...)
if !ok {
return "", false
// Returns false if value is not found and an error if not a string.
func NestedString(obj map[string]interface{}, fields ...string) (string, bool, error) {
val, found, err := nestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return "", found, err
}
s, ok := val.(string)
return s, ok
if !ok {
return "", false, fmt.Errorf("%v accessor error: %v is of the type %T, expected string", jsonPath(fields), val, val)
}
return s, true, nil
}
// NestedBool returns the bool value of a nested field.
// Returns false if value is not found or is not a bool.
func NestedBool(obj map[string]interface{}, fields ...string) (bool, bool) {
val, ok := nestedFieldNoCopy(obj, fields...)
if !ok {
return false, false
// Returns false if value is not found and an error if not a bool.
func NestedBool(obj map[string]interface{}, fields ...string) (bool, bool, error) {
val, found, err := nestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return false, found, err
}
b, ok := val.(bool)
return b, ok
if !ok {
return false, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected bool", jsonPath(fields), val, val)
}
return b, true, nil
}
// NestedFloat64 returns the bool value of a nested field.
// Returns false if value is not found or is not a float64.
func NestedFloat64(obj map[string]interface{}, fields ...string) (float64, bool) {
val, ok := nestedFieldNoCopy(obj, fields...)
if !ok {
return 0, false
// NestedFloat64 returns the float64 value of a nested field.
// Returns false if value is not found and an error if not a float64.
func NestedFloat64(obj map[string]interface{}, fields ...string) (float64, bool, error) {
val, found, err := nestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return 0, found, err
}
f, ok := val.(float64)
return f, ok
if !ok {
return 0, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected float64", jsonPath(fields), val, val)
}
return f, true, nil
}
// NestedInt64 returns the int64 value of a nested field.
// Returns false if value is not found or is not an int64.
func NestedInt64(obj map[string]interface{}, fields ...string) (int64, bool) {
val, ok := nestedFieldNoCopy(obj, fields...)
if !ok {
return 0, false
// Returns false if value is not found and an error if not an int64.
func NestedInt64(obj map[string]interface{}, fields ...string) (int64, bool, error) {
val, found, err := nestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return 0, found, err
}
i, ok := val.(int64)
return i, ok
if !ok {
return 0, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected int64", jsonPath(fields), val, val)
}
return i, true, nil
}
// NestedStringSlice returns a copy of []string value of a nested field.
// Returns false if value is not found, is not a []interface{} or contains non-string items in the slice.
func NestedStringSlice(obj map[string]interface{}, fields ...string) ([]string, bool) {
val, ok := nestedFieldNoCopy(obj, fields...)
// Returns false if value is not found and an error if not a []interface{} or contains non-string items in the slice.
func NestedStringSlice(obj map[string]interface{}, fields ...string) ([]string, bool, error) {
val, found, err := nestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
m, ok := val.([]interface{})
if !ok {
return nil, false
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected []interface{}", jsonPath(fields), val, val)
}
if m, ok := val.([]interface{}); ok {
strSlice := make([]string, 0, len(m))
for _, v := range m {
if str, ok := v.(string); ok {
strSlice = append(strSlice, str)
} else {
return nil, false
}
strSlice := make([]string, 0, len(m))
for _, v := range m {
if str, ok := v.(string); ok {
strSlice = append(strSlice, str)
} else {
return nil, false, fmt.Errorf("%v accessor error: contains non-string key in the slice: %v is of the type %T, expected string", jsonPath(fields), v, v)
}
return strSlice, true
}
return nil, false
return strSlice, true, nil
}
// NestedSlice returns a deep copy of []interface{} value of a nested field.
// Returns false if value is not found or is not a []interface{}.
func NestedSlice(obj map[string]interface{}, fields ...string) ([]interface{}, bool) {
val, ok := nestedFieldNoCopy(obj, fields...)
// Returns false if value is not found and an error if not a []interface{}.
func NestedSlice(obj map[string]interface{}, fields ...string) ([]interface{}, bool, error) {
val, found, err := nestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
_, ok := val.([]interface{})
if !ok {
return nil, false
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected []interface{}", jsonPath(fields), val, val)
}
if _, ok := val.([]interface{}); ok {
return runtime.DeepCopyJSONValue(val).([]interface{}), true
}
return nil, false
return runtime.DeepCopyJSONValue(val).([]interface{}), true, nil
}
// NestedStringMap returns a copy of map[string]string value of a nested field.
// Returns false if value is not found, is not a map[string]interface{} or contains non-string values in the map.
func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]string, bool) {
m, ok := nestedMapNoCopy(obj, fields...)
if !ok {
return nil, false
// Returns false if value is not found and an error if not a map[string]interface{} or contains non-string values in the map.
func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]string, bool, error) {
m, found, err := nestedMapNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
strMap := make(map[string]string, len(m))
for k, v := range m {
if str, ok := v.(string); ok {
strMap[k] = str
} else {
return nil, false
return nil, false, fmt.Errorf("%v accessor error: contains non-string key in the map: %v is of the type %T, expected string", jsonPath(fields), v, v)
}
}
return strMap, true
return strMap, true, nil
}
// NestedMap returns a deep copy of map[string]interface{} value of a nested field.
// Returns false if value is not found or is not a map[string]interface{}.
func NestedMap(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool) {
m, ok := nestedMapNoCopy(obj, fields...)
if !ok {
return nil, false
// Returns false if value is not found and an error if not a map[string]interface{}.
func NestedMap(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool, error) {
m, found, err := nestedMapNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
return runtime.DeepCopyJSON(m), true
return runtime.DeepCopyJSON(m), true, nil
}
// nestedMapNoCopy returns a map[string]interface{} value of a nested field.
// Returns false if value is not found or is not a map[string]interface{}.
func nestedMapNoCopy(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool) {
val, ok := nestedFieldNoCopy(obj, fields...)
if !ok {
return nil, false
// Returns false if value is not found and an error if not a map[string]interface{}.
func nestedMapNoCopy(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool, error) {
val, found, err := nestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
m, ok := val.(map[string]interface{})
return m, ok
if !ok {
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected map[string]interface{}", jsonPath(fields), val, val)
}
return m, true, nil
}
// SetNestedField sets the value of a nested field to a deep copy of the value provided.
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedField(obj map[string]interface{}, value interface{}, fields ...string) bool {
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedField(obj map[string]interface{}, value interface{}, fields ...string) error {
return setNestedFieldNoCopy(obj, runtime.DeepCopyJSONValue(value), fields...)
}
func setNestedFieldNoCopy(obj map[string]interface{}, value interface{}, fields ...string) bool {
func setNestedFieldNoCopy(obj map[string]interface{}, value interface{}, fields ...string) error {
m := obj
for _, field := range fields[:len(fields)-1] {
for i, field := range fields[:len(fields)-1] {
if val, ok := m[field]; ok {
if valMap, ok := val.(map[string]interface{}); ok {
m = valMap
} else {
return false
return fmt.Errorf("value cannot be set because %v is not a map[string]interface{}", jsonPath(fields[:i+1]))
}
} else {
newVal := make(map[string]interface{})
@ -196,12 +214,12 @@ func setNestedFieldNoCopy(obj map[string]interface{}, value interface{}, fields
}
}
m[fields[len(fields)-1]] = value
return true
return nil
}
// SetNestedStringSlice sets the string slice value of a nested field.
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...string) bool {
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...string) error {
m := make([]interface{}, 0, len(value)) // convert []string into []interface{}
for _, v := range value {
m = append(m, v)
@ -210,14 +228,14 @@ func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...
}
// SetNestedSlice sets the slice value of a nested field.
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedSlice(obj map[string]interface{}, value []interface{}, fields ...string) bool {
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedSlice(obj map[string]interface{}, value []interface{}, fields ...string) error {
return SetNestedField(obj, value, fields...)
}
// SetNestedStringMap sets the map[string]string value of a nested field.
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fields ...string) bool {
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fields ...string) error {
m := make(map[string]interface{}, len(value)) // convert map[string]string into map[string]interface{}
for k, v := range value {
m[k] = v
@ -226,8 +244,8 @@ func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fie
}
// SetNestedMap sets the map[string]interface{} value of a nested field.
// Returns false if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedMap(obj map[string]interface{}, value map[string]interface{}, fields ...string) bool {
// Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}.
func SetNestedMap(obj map[string]interface{}, value map[string]interface{}, fields ...string) error {
return SetNestedField(obj, value, fields...)
}
@ -245,22 +263,26 @@ func RemoveNestedField(obj map[string]interface{}, fields ...string) {
}
func getNestedString(obj map[string]interface{}, fields ...string) string {
val, ok := NestedString(obj, fields...)
if !ok {
val, found, err := NestedString(obj, fields...)
if !found || err != nil {
return ""
}
return val
}
func jsonPath(fields []string) string {
return "." + strings.Join(fields, ".")
}
func extractOwnerReference(v map[string]interface{}) metav1.OwnerReference {
// though this field is a *bool, but when decoded from JSON, it's
// unmarshalled as bool.
var controllerPtr *bool
if controller, ok := NestedBool(v, "controller"); ok {
if controller, found, err := NestedBool(v, "controller"); err == nil && found {
controllerPtr = &controller
}
var blockOwnerDeletionPtr *bool
if blockOwnerDeletion, ok := NestedBool(v, "blockOwnerDeletion"); ok {
if blockOwnerDeletion, found, err := NestedBool(v, "blockOwnerDeletion"); err == nil && found {
blockOwnerDeletionPtr = &blockOwnerDeletion
}
return metav1.OwnerReference{

View File

@ -138,8 +138,8 @@ func (u *Unstructured) setNestedMap(value map[string]string, fields ...string) {
}
func (u *Unstructured) GetOwnerReferences() []metav1.OwnerReference {
field, ok := nestedFieldNoCopy(u.Object, "metadata", "ownerReferences")
if !ok {
field, found, err := nestedFieldNoCopy(u.Object, "metadata", "ownerReferences")
if !found || err != nil {
return nil
}
original, ok := field.([]interface{})
@ -228,8 +228,8 @@ func (u *Unstructured) SetResourceVersion(version string) {
}
func (u *Unstructured) GetGeneration() int64 {
val, ok := NestedInt64(u.Object, "metadata", "generation")
if !ok {
val, found, err := NestedInt64(u.Object, "metadata", "generation")
if !found || err != nil {
return 0
}
return val
@ -289,8 +289,8 @@ func (u *Unstructured) SetDeletionTimestamp(timestamp *metav1.Time) {
}
func (u *Unstructured) GetDeletionGracePeriodSeconds() *int64 {
val, ok := NestedInt64(u.Object, "metadata", "deletionGracePeriodSeconds")
if !ok {
val, found, err := NestedInt64(u.Object, "metadata", "deletionGracePeriodSeconds")
if !found || err != nil {
return nil
}
return &val
@ -305,7 +305,7 @@ func (u *Unstructured) SetDeletionGracePeriodSeconds(deletionGracePeriodSeconds
}
func (u *Unstructured) GetLabels() map[string]string {
m, _ := NestedStringMap(u.Object, "metadata", "labels")
m, _, _ := NestedStringMap(u.Object, "metadata", "labels")
return m
}
@ -314,7 +314,7 @@ func (u *Unstructured) SetLabels(labels map[string]string) {
}
func (u *Unstructured) GetAnnotations() map[string]string {
m, _ := NestedStringMap(u.Object, "metadata", "annotations")
m, _, _ := NestedStringMap(u.Object, "metadata", "annotations")
return m
}
@ -337,8 +337,8 @@ func (u *Unstructured) GroupVersionKind() schema.GroupVersionKind {
}
func (u *Unstructured) GetInitializers() *metav1.Initializers {
m, ok := nestedMapNoCopy(u.Object, "metadata", "initializers")
if !ok {
m, found, err := nestedMapNoCopy(u.Object, "metadata", "initializers")
if !found || err != nil {
return nil
}
out := &metav1.Initializers{}
@ -362,7 +362,7 @@ func (u *Unstructured) SetInitializers(initializers *metav1.Initializers) {
}
func (u *Unstructured) GetFinalizers() []string {
val, _ := NestedStringSlice(u.Object, "metadata", "finalizers")
val, _, _ := NestedStringSlice(u.Object, "metadata", "finalizers")
return val
}

View File

@ -35,8 +35,9 @@ func TestUnstructuredList(t *testing.T) {
content := list.UnstructuredContent()
items := content["items"].([]interface{})
require.Len(t, items, 1)
val, ok := NestedFieldCopy(items[0].(map[string]interface{}), "metadata", "name")
require.True(t, ok)
val, found, err := NestedFieldCopy(items[0].(map[string]interface{}), "metadata", "name")
require.True(t, found)
require.NoError(t, err)
assert.Equal(t, "test", val)
}

View File

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
// Code generated by deepcopy-gen. DO NOT EDIT.
package unstructured
@ -35,9 +35,8 @@ func (in *Unstructured) DeepCopyInto(out *Unstructured) {
func (in *Unstructured) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -51,7 +50,6 @@ func (in *UnstructuredList) DeepCopyInto(out *UnstructuredList) {
func (in *UnstructuredList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["validation_test.go"],
importpath = "k8s.io/apimachinery/pkg/apis/meta/v1/validation",
library = ":go_default_library",
embed = [":go_default_library"],
deps = ["//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library"],
)

View File

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1
@ -57,9 +57,8 @@ func (in *APIGroup) DeepCopy() *APIGroup {
func (in *APIGroup) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -90,9 +89,8 @@ func (in *APIGroupList) DeepCopy() *APIGroupList {
func (in *APIGroupList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -154,9 +152,8 @@ func (in *APIResourceList) DeepCopy() *APIResourceList {
func (in *APIResourceList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -190,9 +187,8 @@ func (in *APIVersions) DeepCopy() *APIVersions {
func (in *APIVersions) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -252,9 +248,8 @@ func (in *DeleteOptions) DeepCopy() *DeleteOptions {
func (in *DeleteOptions) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -294,9 +289,8 @@ func (in *ExportOptions) DeepCopy() *ExportOptions {
func (in *ExportOptions) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -320,9 +314,8 @@ func (in *GetOptions) DeepCopy() *GetOptions {
func (in *GetOptions) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -568,9 +561,8 @@ func (in *List) DeepCopy() *List {
func (in *List) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -619,9 +611,8 @@ func (in *ListOptions) DeepCopy() *ListOptions {
func (in *ListOptions) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroTime.
@ -643,8 +634,7 @@ func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta) {
if *in == nil {
*out = nil
} else {
*out = new(Time)
(*in).DeepCopyInto(*out)
*out = (*in).DeepCopy()
}
}
if in.DeletionGracePeriodSeconds != nil {
@ -847,9 +837,8 @@ func (in *Status) DeepCopy() *Status {
func (in *Status) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -915,6 +904,26 @@ func (in *Timestamp) DeepCopy() *Timestamp {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in Verbs) DeepCopyInto(out *Verbs) {
{
in := &in
*out = make(Verbs, len(*in))
copy(*out, *in)
return
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Verbs.
func (in Verbs) DeepCopy() Verbs {
if in == nil {
return nil
}
out := new(Verbs)
in.DeepCopyInto(out)
return *out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WatchEvent) DeepCopyInto(out *WatchEvent) {
*out = *in
@ -936,7 +945,6 @@ func (in *WatchEvent) DeepCopy() *WatchEvent {
func (in *WatchEvent) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}

View File

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by defaulter-gen. Do not edit it manually!
// Code generated by defaulter-gen. DO NOT EDIT.
package v1

View File

@ -1,8 +1,9 @@
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
filegroup(
name = "go_default_library_protos",
srcs = ["generated.proto"],
visibility = ["//visibility:public"],
)
go_library(
@ -18,7 +19,8 @@ go_library(
"zz_generated.deepcopy.go",
"zz_generated.defaults.go",
],
importpath = "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
importpath = "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
@ -39,10 +41,5 @@ filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
filegroup(
name = "go_default_library_protos",
srcs = ["generated.proto"],
visibility = ["//visibility:public"],
)

View File

@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
package v1beta1
import "k8s.io/apimachinery/pkg/conversion"
// Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy allows converting a URL query parameter value
func Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy(input *[]string, out *IncludeObjectPolicy, s conversion.Scope) error {
// Convert_Slice_string_To_v1beta1_IncludeObjectPolicy allows converting a URL query parameter value
func Convert_Slice_string_To_v1beta1_IncludeObjectPolicy(input *[]string, out *IncludeObjectPolicy, s conversion.Scope) error {
if len(*input) > 0 {
*out = IncludeObjectPolicy((*input)[0])
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
package v1beta1
func (in *TableRow) DeepCopy() *TableRow {
if in == nil {

View File

@ -19,4 +19,4 @@ limitations under the License.
// +k8s:defaulter-gen=TypeMeta
// +groupName=meta.k8s.io
package v1alpha1
package v1beta1

View File

@ -15,21 +15,21 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo.
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/generated.proto
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
// DO NOT EDIT!
/*
Package v1alpha1 is a generated protocol buffer package.
Package v1beta1 is a generated protocol buffer package.
It is generated from these files:
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/generated.proto
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
It has these top-level messages:
PartialObjectMetadata
PartialObjectMetadataList
TableOptions
*/
package v1alpha1
package v1beta1
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
@ -66,9 +66,9 @@ func (*TableOptions) ProtoMessage() {}
func (*TableOptions) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
func init() {
proto.RegisterType((*PartialObjectMetadata)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.PartialObjectMetadata")
proto.RegisterType((*PartialObjectMetadataList)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.PartialObjectMetadataList")
proto.RegisterType((*TableOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1alpha1.TableOptions")
proto.RegisterType((*PartialObjectMetadata)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.PartialObjectMetadata")
proto.RegisterType((*PartialObjectMetadataList)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.PartialObjectMetadataList")
proto.RegisterType((*TableOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1beta1.TableOptions")
}
func (m *PartialObjectMetadata) Marshal() (dAtA []byte, err error) {
size := m.Size()
@ -600,34 +600,34 @@ var (
)
func init() {
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1/generated.proto", fileDescriptorGenerated)
proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto", fileDescriptorGenerated)
}
var fileDescriptorGenerated = []byte{
// 392 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbf, 0x6e, 0xd4, 0x40,
0x10, 0x87, 0xbd, 0x42, 0x91, 0x92, 0x0d, 0x69, 0x8c, 0x90, 0xc2, 0x15, 0xeb, 0xe8, 0xaa, 0x08,
0xc1, 0x2e, 0x09, 0x08, 0xd1, 0xe2, 0x2e, 0x12, 0x28, 0x91, 0xa1, 0xa2, 0x62, 0x6d, 0x0f, 0xf6,
0x62, 0x7b, 0xd7, 0xda, 0x1d, 0x47, 0xba, 0x0a, 0x1e, 0x81, 0xc7, 0xba, 0x32, 0x65, 0x2a, 0x8b,
0x33, 0x6f, 0x41, 0x85, 0x6c, 0x5f, 0xc8, 0xbf, 0x3b, 0xe5, 0xba, 0x99, 0xdf, 0xe8, 0xfb, 0x3c,
0xe3, 0xa5, 0x9f, 0x8a, 0x77, 0x8e, 0x2b, 0x23, 0x8a, 0x26, 0x06, 0xab, 0x01, 0xc1, 0x89, 0x73,
0xd0, 0xa9, 0xb1, 0x62, 0x39, 0x90, 0xb5, 0xaa, 0x64, 0x92, 0x2b, 0x0d, 0x76, 0x26, 0xea, 0x22,
0xeb, 0x03, 0x27, 0x2a, 0x40, 0x29, 0xce, 0x8f, 0x64, 0x59, 0xe7, 0xf2, 0x48, 0x64, 0xa0, 0xc1,
0x4a, 0x84, 0x94, 0xd7, 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, 0x74, 0x52, 0x36, 0x29, 0x8c, 0xe8,
0x70, 0xf7, 0x4e, 0xf8, 0x62, 0x79, 0xc5, 0xde, 0xc9, 0xcd, 0xe1, 0xdf, 0x36, 0x78, 0x72, 0x2b,
0x38, 0x33, 0xa5, 0x4a, 0x66, 0xd1, 0x6d, 0x45, 0xc8, 0xe7, 0x0b, 0xe6, 0x5d, 0x2c, 0x98, 0x77,
0xb9, 0x60, 0xde, 0xcf, 0x8e, 0x91, 0x79, 0xc7, 0xc8, 0x45, 0xc7, 0xc8, 0x65, 0xc7, 0xc8, 0xef,
0x8e, 0x91, 0x5f, 0x7f, 0x98, 0xf7, 0x65, 0xfb, 0x6a, 0xf7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff,
0x97, 0x95, 0xbb, 0xf9, 0x14, 0x03, 0x00, 0x00,
// 391 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbd, 0x6e, 0xd4, 0x40,
0x10, 0xc7, 0xbd, 0x42, 0x11, 0x64, 0x43, 0x1a, 0x23, 0xa4, 0x70, 0xc5, 0x3a, 0xba, 0x2a, 0x48,
0x64, 0x97, 0x04, 0x84, 0x28, 0x91, 0xbb, 0x48, 0xa0, 0x44, 0x16, 0x15, 0x15, 0x6b, 0x7b, 0xf0,
0x2d, 0xb6, 0x77, 0xad, 0xdd, 0x71, 0xa4, 0x6b, 0x10, 0x8f, 0xc0, 0x63, 0x5d, 0x99, 0x32, 0x95,
0xc5, 0x99, 0xb7, 0xa0, 0x42, 0xfe, 0x10, 0xf9, 0xb8, 0x3b, 0xe5, 0xba, 0x99, 0xff, 0xe8, 0xf7,
0xf3, 0x8c, 0x97, 0x46, 0xf9, 0x7b, 0xc7, 0x95, 0x11, 0x79, 0x1d, 0x83, 0xd5, 0x80, 0xe0, 0xc4,
0x25, 0xe8, 0xd4, 0x58, 0x31, 0x0e, 0x64, 0xa5, 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,
0xb8, 0xdb, 0x36, 0xc1, 0xce, 0x59, 0xa7, 0x8c, 0x06, 0xf3, 0x34, 0xa6, 0x4f, 0x3f, 0xcb, 0xb8,
0x80, 0xf3, 0x0a, 0x95, 0xd1, 0xce, 0x8f, 0xe8, 0xbe, 0xd2, 0x49, 0x51, 0xa7, 0x30, 0xa0, 0xfd,
0xd9, 0xbb, 0xe1, 0xab, 0xf1, 0x88, 0xfd, 0xb3, 0xdb, 0xc3, 0xbf, 0x4d, 0xf0, 0xec, 0x4e, 0x70,
0x61, 0x0a, 0x95, 0xcc, 0xa3, 0xbb, 0x8a, 0xf0, 0x78, 0xb1, 0x64, 0xde, 0xd5, 0x92, 0x79, 0xd7,
0x4b, 0xe6, 0xfd, 0x6c, 0x19, 0x59, 0xb4, 0x8c, 0x5c, 0xb5, 0x8c, 0x5c, 0xb7, 0x8c, 0xfc, 0x6e,
0x19, 0xf9, 0xf5, 0x87, 0x79, 0x5f, 0x1e, 0x8f, 0xab, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x73,
0xdf, 0x3a, 0x0c, 0x10, 0x03, 0x00, 0x00,
}

View File

@ -19,7 +19,7 @@ limitations under the License.
syntax = 'proto2';
package k8s.io.apimachinery.pkg.apis.meta.v1alpha1;
package k8s.io.apimachinery.pkg.apis.meta.v1beta1;
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
@ -27,7 +27,7 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1alpha1";
option go_package = "v1beta1";
// PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients
// to get access to a particular ObjectMeta schema without knowing the details of the version.
@ -52,7 +52,7 @@ message TableOptions {
// includeObject decides whether to include each object along with its columnar information.
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
// in version v1alpha1 of the meta.k8s.io API group.
// in version v1beta1 of the meta.k8s.io API group.
optional string includeObject = 1;
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
package v1beta1
import (
"k8s.io/apimachinery/pkg/runtime"
@ -25,17 +25,17 @@ import (
const GroupName = "meta.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// scheme is the registry for the common types that adhere to the meta v1alpha1 API spec.
// scheme is the registry for the common types that adhere to the meta v1beta1 API spec.
var scheme = runtime.NewScheme()
// ParameterCodec knows about query parameters used with the meta v1alpha1 API spec.
// ParameterCodec knows about query parameters used with the meta v1beta1 API spec.
var ParameterCodec = runtime.NewParameterCodec(scheme)
func init() {
@ -47,7 +47,7 @@ func init() {
)
if err := scheme.AddConversionFuncs(
Convert_Slice_string_To_v1alpha1_IncludeObjectPolicy,
Convert_Slice_string_To_v1beta1_IncludeObjectPolicy,
); err != nil {
panic(err)
}

View File

@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// package v1alpha1 is alpha objects from meta that will be introduced.
package v1alpha1
// package v1beta1 is alpha objects from meta that will be introduced.
package v1beta1
import (
"k8s.io/apimachinery/pkg/apis/meta/v1"
@ -136,7 +136,7 @@ type TableOptions struct {
// includeObject decides whether to include each object along with its columnar information.
// Specifying "None" will return no object, specifying "Object" will return the full object contents, and
// specifying "Metadata" (the default) will return the object's metadata in the PartialObjectMetadata kind
// in version v1alpha1 of the meta.k8s.io API group.
// in version v1beta1 of the meta.k8s.io API group.
IncludeObject IncludeObjectPolicy `json:"includeObject,omitempty" protobuf:"bytes,1,opt,name=includeObject,casttype=IncludeObjectPolicy"`
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
package v1beta1
// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
@ -71,7 +71,7 @@ func (TableColumnDefinition) SwaggerDoc() map[string]string {
var map_TableOptions = map[string]string{
"": "TableOptions are used when a Table is requested by the caller.",
"includeObject": "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1alpha1 of the meta.k8s.io API group.",
"includeObject": "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.",
}
func (TableOptions) SwaggerDoc() map[string]string {

View File

@ -16,9 +16,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1alpha1
package v1beta1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
@ -46,9 +46,8 @@ func (in *PartialObjectMetadata) DeepCopy() *PartialObjectMetadata {
func (in *PartialObjectMetadata) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -84,9 +83,8 @@ func (in *PartialObjectMetadataList) DeepCopy() *PartialObjectMetadataList {
func (in *PartialObjectMetadataList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -123,9 +121,8 @@ func (in *Table) DeepCopy() *Table {
func (in *Table) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -165,9 +162,8 @@ func (in *TableOptions) DeepCopy() *TableOptions {
func (in *TableOptions) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

View File

@ -16,9 +16,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by defaulter-gen. Do not edit it manually!
// Code generated by defaulter-gen. DO NOT EDIT.
package v1alpha1
package v1beta1
import (
runtime "k8s.io/apimachinery/pkg/runtime"

View File

@ -22,8 +22,7 @@ go_library(
go_test(
name = "go_default_test",
srcs = ["roundtrip_test.go"],
importpath = "k8s.io/apimachinery/pkg/apis/testapigroup/install",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/api/testing/roundtrip:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/testapigroup/fuzzer:go_default_library",

View File

@ -14,7 +14,6 @@ go_library(
"generated.pb.go",
"register.go",
"types.go",
"types_swagger_doc_generated.go",
"zz_generated.conversion.go",
"zz_generated.deepcopy.go",
"zz_generated.defaults.go",

View File

@ -1,5 +1,5 @@
/*
Copyright 2017 The Kubernetes Authors.
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -1938,72 +1938,72 @@ func init() {
}
var fileDescriptorGenerated = []byte{
// 1065 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcd, 0x6e, 0xdb, 0x46,
0x10, 0xb6, 0x2c, 0xcb, 0x92, 0xd6, 0x56, 0x62, 0x6f, 0x62, 0x80, 0x31, 0x10, 0xc9, 0x71, 0x0b,
0xc3, 0x29, 0x1a, 0xb2, 0x76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 0x36, 0x2f, 0xdc,
0x3a, 0x9b, 0xb7, 0xd0, 0x62, 0x5c, 0xe1, 0xeb, 0x33, 0x3c, 0x6e, 0x00, 0x92, 0x78, 0xf1, 0x47,
0xa8, 0x14, 0x31, 0xef, 0xd0, 0x49, 0x26, 0x78, 0x36, 0x03, 0x1d, 0x65, 0x24, 0xb1, 0x0f, 0xbf,
0x46, 0x55, 0x3d, 0xb8, 0xf4, 0xfe, 0x29, 0xdf, 0x79, 0xff, 0xd4, 0x74, 0x77, 0xa4, 0x02, 0x64,
0xac, 0x65, 0x6f, 0x5f, 0x5c, 0xd6, 0xe7, 0xde, 0x5e, 0xd6, 0xe7, 0xde, 0x5d, 0xd6, 0xe7, 0x7e,
0x1b, 0xd5, 0x0b, 0x17, 0xa3, 0x7a, 0xe1, 0xed, 0xa8, 0x5e, 0x78, 0x37, 0xaa, 0x17, 0xfe, 0x1d,
0xd5, 0x0b, 0xbf, 0xff, 0x57, 0x9f, 0xfb, 0x61, 0xbe, 0xbf, 0xf3, 0x7f, 0x00, 0x00, 0x00, 0xff,
0xff, 0x55, 0x69, 0xbd, 0x27, 0x83, 0x0a, 0x00, 0x00,
// 1062 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x6e, 0xdb, 0xc6,
0x13, 0x36, 0x2d, 0xc9, 0x96, 0xd6, 0x56, 0x62, 0x6f, 0x62, 0x80, 0x3f, 0x03, 0x91, 0x1c, 0x1f,
0x0c, 0xff, 0x8a, 0x94, 0x8c, 0xdd, 0x26, 0x70, 0x9b, 0x43, 0x11, 0xda, 0x45, 0xed, 0xc2, 0x71,
0x84, 0x95, 0x8b, 0x14, 0x45, 0x0f, 0x59, 0x51, 0x53, 0x99, 0x95, 0xc8, 0x25, 0x76, 0x97, 0x2a,
0x74, 0x2b, 0xfa, 0x04, 0x7d, 0x88, 0xde, 0x7a, 0xee, 0x03, 0x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 0x57, 0xd4, 0xf2, 0xdc, 0x2b, 0xaa, 0xaa, 0x7b, 0x25, 0x15, 0x20, 0x63, 0x2d,
0x67, 0xf7, 0xf2, 0xaa, 0xb6, 0xf0, 0xe6, 0xaa, 0xb6, 0xf0, 0xf6, 0xaa, 0xb6, 0xf0, 0xf3, 0xa8,
0x66, 0x5c, 0x8e, 0x6a, 0xc6, 0x9b, 0x51, 0xcd, 0x78, 0x3b, 0xaa, 0x19, 0x7f, 0x8f, 0x6a, 0xc6,
0xaf, 0xff, 0xd4, 0x16, 0xbe, 0x5b, 0xec, 0xef, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xaa,
0x9e, 0x7b, 0xcb, 0x0a, 0x00, 0x00,
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2017 The Kubernetes Authors.
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -122,7 +122,7 @@ message CarpSpec {
map<string, string> nodeSelector = 7;
// ServiceAccountName is the name of the ServiceAccount to use to run this carp.
// More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md
// More info: https://git.k8s.io/community/contributors/design-proposals/auth/service_accounts.md
// +optional
optional string serviceAccountName = 8;

View File

@ -136,7 +136,7 @@ type CarpSpec struct {
NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,7,rep,name=nodeSelector"`
// ServiceAccountName is the name of the ServiceAccount to use to run this carp.
// More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md
// More info: https://git.k8s.io/community/contributors/design-proposals/auth/service_accounts.md
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,8,opt,name=serviceAccountName"`
// DeprecatedServiceAccount is a depreciated alias for ServiceAccountName.

View File

@ -1,17 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1

View File

@ -16,16 +16,17 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by conversion-gen. Do not edit it manually!
// Code generated by conversion-gen. DO NOT EDIT.
package v1
import (
unsafe "unsafe"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
testapigroup "k8s.io/apimachinery/pkg/apis/testapigroup"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
unsafe "unsafe"
)
func init() {

View File

@ -16,12 +16,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1
import (
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -49,9 +48,8 @@ func (in *Carp) DeepCopy() *Carp {
func (in *Carp) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -101,9 +99,8 @@ func (in *CarpList) DeepCopy() *CarpList {
func (in *CarpList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -162,8 +159,7 @@ func (in *CarpStatus) DeepCopyInto(out *CarpStatus) {
if *in == nil {
*out = nil
} else {
*out = new(meta_v1.Time)
(*in).DeepCopyInto(*out)
*out = (*in).DeepCopy()
}
}
return

View File

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by defaulter-gen. Do not edit it manually!
// Code generated by defaulter-gen. DO NOT EDIT.
package v1

View File

@ -16,12 +16,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
// Code generated by deepcopy-gen. DO NOT EDIT.
package testapigroup
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -49,9 +48,8 @@ func (in *Carp) DeepCopy() *Carp {
func (in *Carp) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -101,9 +99,8 @@ func (in *CarpList) DeepCopy() *CarpList {
func (in *CarpList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -162,8 +159,7 @@ func (in *CarpStatus) DeepCopyInto(out *CarpStatus) {
if *in == nil {
*out = nil
} else {
*out = new(v1.Time)
(*in).DeepCopyInto(*out)
*out = (*in).DeepCopy()
}
}
return

View File

@ -12,8 +12,7 @@ go_test(
"converter_test.go",
"helper_test.go",
],
importpath = "k8s.io/apimachinery/pkg/conversion",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/google/gofuzz:go_default_library",
"//vendor/github.com/spf13/pflag:go_default_library",

View File

@ -343,7 +343,7 @@ func TestConverter_GeneratedConversionOverriden(t *testing.T) {
t.Fatalf("unexpected error %v", err)
}
if err := c.RegisterGeneratedConversionFunc(func(in *A, out *B, s Scope) error {
return fmt.Errorf("generated function should be overriden")
return fmt.Errorf("generated function should be overridden")
}); err != nil {
t.Fatalf("unexpected error %v", err)
}
@ -360,12 +360,12 @@ func TestConverter_WithConversionOverriden(t *testing.T) {
type B struct{}
c := NewConverter(DefaultNameFunc)
if err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error {
return fmt.Errorf("conversion function should be overriden")
return fmt.Errorf("conversion function should be overridden")
}); err != nil {
t.Fatalf("unexpected error %v", err)
}
if err := c.RegisterGeneratedConversionFunc(func(in *A, out *B, s Scope) error {
return fmt.Errorf("generated function should be overriden")
return fmt.Errorf("generated function should be overridden")
}); err != nil {
t.Fatalf("unexpected error %v", err)
}
@ -378,7 +378,7 @@ func TestConverter_WithConversionOverriden(t *testing.T) {
a := A{}
b := B{}
if err := c.Convert(&a, &b, 0, nil); err == nil || err.Error() != "conversion function should be overriden" {
if err := c.Convert(&a, &b, 0, nil); err == nil || err.Error() != "conversion function should be overridden" {
t.Errorf("unexpected error: %v", err)
}
if err := newc.Convert(&a, &b, 0, nil); err != nil {

View File

@ -18,7 +18,6 @@ go_library(
go_test(
name = "go_default_xtest",
srcs = ["convert_test.go"],
importpath = "k8s.io/apimachinery/pkg/conversion/queryparams_test",
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion/queryparams:go_default_library",

View File

@ -12,8 +12,7 @@ go_test(
"fields_test.go",
"selector_test.go",
],
importpath = "k8s.io/apimachinery/pkg/fields",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View File

@ -396,7 +396,7 @@ const (
var termOperators = []string{notEqualOperator, doubleEqualOperator, equalOperator}
// splitTerm returns the lhs, operator, and rhs parsed from the given term, along with an indicator of whether the parse was successful.
// no escaping of special characters is supported in the lhs value, so the first occurance of a recognized operator is used as the split point.
// no escaping of special characters is supported in the lhs value, so the first occurrence of a recognized operator is used as the split point.
// the literal rhs is returned, and the caller is responsible for applying any desired unescaping.
func splitTerm(term string) (lhs, op, rhs string, ok bool) {
for i := range term {

View File

@ -12,8 +12,7 @@ go_test(
"labels_test.go",
"selector_test.go",
],
importpath = "k8s.io/apimachinery/pkg/labels",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/selection:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",

View File

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
// Code generated by deepcopy-gen. DO NOT EDIT.
package labels

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["swagger_doc_generator_test.go"],
importpath = "k8s.io/apimachinery/pkg/runtime",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(
@ -57,7 +56,6 @@ go_test(
"extension_test.go",
"scheme_test.go",
],
importpath = "k8s.io/apimachinery/pkg/runtime_test",
deps = [
"//vendor/github.com/google/gofuzz:go_default_library",
"//vendor/github.com/spf13/pflag:go_default_library",

View File

@ -281,7 +281,7 @@ func (disabledGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersi
// GroupVersioners implements GroupVersioner and resolves to the first exact match for any kind.
type GroupVersioners []GroupVersioner
// KindForGroupVersionKinds returns the first match of any of the group versioners, or false if no match occured.
// KindForGroupVersionKinds returns the first match of any of the group versioners, or false if no match occurred.
func (gvs GroupVersioners) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
for _, gv := range gvs {
target, ok := gv.KindForGroupVersionKinds(kinds)

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["group_version_test.go"],
importpath = "k8s.io/apimachinery/pkg/runtime/schema",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(

View File

@ -36,6 +36,21 @@ func ParseResourceArg(arg string) (*GroupVersionResource, GroupResource) {
return gvr, ParseGroupResource(arg)
}
// ParseKindArg takes the common style of string which may be either `Kind.group.com` or `Kind.version.group.com`
// and parses it out into both possibilities. This code takes no responsibility for knowing which representation was intended
// but with a knowledge of all GroupKinds, calling code can take a very good guess. If there are only two segments, then
// `*GroupVersionResource` is nil.
// `Kind.group.com` -> `group=com, version=group, kind=Kind` and `group=group.com, kind=Kind`
func ParseKindArg(arg string) (*GroupVersionKind, GroupKind) {
var gvk *GroupVersionKind
if strings.Count(arg, ".") >= 2 {
s := strings.SplitN(arg, ".", 3)
gvk = &GroupVersionKind{Group: s[2], Version: s[1], Kind: s[0]}
}
return gvk, ParseGroupKind(arg)
}
// GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying
// concepts during lookup stages without having partially valid types
type GroupResource struct {
@ -58,6 +73,15 @@ func (gr *GroupResource) String() string {
return gr.Resource + "." + gr.Group
}
func ParseGroupKind(gk string) GroupKind {
i := strings.Index(gk, ".")
if i == -1 {
return GroupKind{Kind: gk}
}
return GroupKind{Group: gk[i+1:], Kind: gk[:i]}
}
// ParseGroupResource turns "resource.group" string into a GroupResource struct. Empty strings are allowed
// for each field.
func ParseGroupResource(gr string) GroupResource {

View File

@ -431,6 +431,7 @@ func (s *Scheme) Convert(in, out interface{}, context interface{}) error {
return err
}
unstructuredOut.SetUnstructuredContent(content)
unstructuredOut.GetObjectKind().SetGroupVersionKind(gvk)
return nil
}

View File

@ -37,11 +37,13 @@ var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.")
func TestScheme(t *testing.T) {
internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
internalGVK := internalGV.WithKind("Simple")
externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"}
externalGVK := externalGV.WithKind("Simple")
scheme := runtime.NewScheme()
scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{})
scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{})
scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{})
scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{})
// If set, would clear TypeMeta during conversion.
//scheme.AddIgnoredConversionType(&TypeMeta{}, &TypeMeta{})
@ -55,14 +57,26 @@ func TestScheme(t *testing.T) {
// Register functions to verify that scope.Meta() gets set correctly.
err := scheme.AddConversionFuncs(
func(in *runtimetesting.InternalSimple, out *runtimetesting.ExternalSimple, scope conversion.Scope) error {
scope.Convert(&in.TypeMeta, &out.TypeMeta, 0)
scope.Convert(&in.TestString, &out.TestString, 0)
err := scope.Convert(&in.TypeMeta, &out.TypeMeta, 0)
if err != nil {
return err
}
err = scope.Convert(&in.TestString, &out.TestString, 0)
if err != nil {
return err
}
internalToExternalCalls++
return nil
},
func(in *runtimetesting.ExternalSimple, out *runtimetesting.InternalSimple, scope conversion.Scope) error {
scope.Convert(&in.TypeMeta, &out.TypeMeta, 0)
scope.Convert(&in.TestString, &out.TestString, 0)
err := scope.Convert(&in.TypeMeta, &out.TypeMeta, 0)
if err != nil {
return err
}
err = scope.Convert(&in.TestString, &out.TestString, 0)
if err != nil {
return err
}
externalToInternalCalls++
return nil
},
@ -71,140 +85,160 @@ func TestScheme(t *testing.T) {
t.Fatalf("unexpected error: %v", err)
}
codecs := serializer.NewCodecFactory(scheme)
codec := codecs.LegacyCodec(externalGV)
info, _ := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), runtime.ContentTypeJSON)
jsonserializer := info.Serializer
t.Run("Encode, Decode, DecodeInto, and DecodeToVersion", func(t *testing.T) {
simple := &runtimetesting.InternalSimple{
TestString: "foo",
}
simple := &runtimetesting.InternalSimple{
TestString: "foo",
}
codecs := serializer.NewCodecFactory(scheme)
codec := codecs.LegacyCodec(externalGV)
info, _ := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), runtime.ContentTypeJSON)
jsonserializer := info.Serializer
// Test Encode, Decode, DecodeInto, and DecodeToVersion
obj := runtime.Object(simple)
data, err := runtime.Encode(codec, obj)
if err != nil {
t.Fatal(err)
}
obj := runtime.Object(simple)
data, err := runtime.Encode(codec, obj)
if err != nil {
t.Fatal(err)
}
obj2, err := runtime.Decode(codec, data)
if err != nil {
t.Fatal(err)
}
if _, ok := obj2.(*runtimetesting.InternalSimple); !ok {
t.Fatalf("Got wrong type")
}
if e, a := simple, obj2; !reflect.DeepEqual(e, a) {
t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a)
}
obj2, err := runtime.Decode(codec, data)
if err != nil {
t.Fatal(err)
}
if _, ok := obj2.(*runtimetesting.InternalSimple); !ok {
t.Fatalf("Got wrong type")
}
if e, a := simple, obj2; !reflect.DeepEqual(e, a) {
t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a)
}
obj3 := &runtimetesting.InternalSimple{}
if err := runtime.DecodeInto(codec, data, obj3); err != nil {
t.Fatal(err)
}
// clearing TypeMeta is a function of the scheme, which we do not test here (ConvertToVersion
// does not automatically clear TypeMeta anymore).
simple.TypeMeta = runtime.TypeMeta{Kind: "Simple", APIVersion: externalGV.String()}
if e, a := simple, obj3; !reflect.DeepEqual(e, a) {
t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a)
}
obj3 := &runtimetesting.InternalSimple{}
if err := runtime.DecodeInto(codec, data, obj3); err != nil {
t.Fatal(err)
}
// clearing TypeMeta is a function of the scheme, which we do not test here (ConvertToVersion
// does not automatically clear TypeMeta anymore).
simple.TypeMeta = runtime.TypeMeta{Kind: "Simple", APIVersion: externalGV.String()}
if e, a := simple, obj3; !reflect.DeepEqual(e, a) {
t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a)
}
obj4, err := runtime.Decode(jsonserializer, data)
if err != nil {
t.Fatal(err)
}
if _, ok := obj4.(*runtimetesting.ExternalSimple); !ok {
t.Fatalf("Got wrong type")
}
obj4, err := runtime.Decode(jsonserializer, data)
if err != nil {
t.Fatal(err)
}
if _, ok := obj4.(*runtimetesting.ExternalSimple); !ok {
t.Fatalf("Got wrong type")
}
})
t.Run("Convert", func(t *testing.T) {
simple := &runtimetesting.InternalSimple{
TestString: "foo",
}
// Test Convert
external := &runtimetesting.ExternalSimple{}
err = scheme.Convert(simple, external, nil)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if e, a := simple.TestString, external.TestString; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
external := &runtimetesting.ExternalSimple{}
err = scheme.Convert(simple, external, nil)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if e, a := simple.TestString, external.TestString; e != a {
t.Errorf("Expected %q, got %q", e, a)
}
})
t.Run("Convert internal to unstructured", func(t *testing.T) {
simple := &runtimetesting.InternalSimple{
TestString: "foo",
}
// Test convert internal to unstructured
unstructuredObj := &runtimetesting.Unstructured{}
err = scheme.Convert(simple, unstructuredObj, nil)
if err == nil || !strings.Contains(err.Error(), "to Unstructured without providing a preferred version to convert to") {
t.Fatalf("Unexpected non-error: %v", err)
}
err = scheme.Convert(simple, unstructuredObj, schema.GroupVersion{Group: "test.group", Version: "testExternal"})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if e, a := simple.TestString, unstructuredObj.Object["testString"].(string); e != a {
t.Errorf("Expected %v, got %v", e, a)
}
if e := unstructuredObj.GetObjectKind().GroupVersionKind(); !reflect.DeepEqual(e, schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) {
t.Errorf("Unexpected object kind: %#v", e)
}
if gvks, unversioned, err := scheme.ObjectKinds(unstructuredObj); err != nil || !reflect.DeepEqual(gvks[0], schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) || unversioned {
t.Errorf("Scheme did not recognize unversioned: %v, %#v %t", err, gvks, unversioned)
}
unstructuredObj := &runtimetesting.Unstructured{}
err = scheme.Convert(simple, unstructuredObj, nil)
if err == nil || !strings.Contains(err.Error(), "to Unstructured without providing a preferred version to convert to") {
t.Fatalf("Unexpected non-error: %v", err)
}
err = scheme.Convert(simple, unstructuredObj, externalGV)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if e, a := simple.TestString, unstructuredObj.Object["testString"].(string); e != a {
t.Errorf("Expected %q, got %q", e, a)
}
if e := unstructuredObj.GetObjectKind().GroupVersionKind(); e != externalGVK {
t.Errorf("Unexpected object kind: %#v", e)
}
if gvks, unversioned, err := scheme.ObjectKinds(unstructuredObj); err != nil || gvks[0] != externalGVK || unversioned {
t.Errorf("Scheme did not recognize unversioned: %v, %#v %t", err, gvks, unversioned)
}
})
t.Run("Convert external to unstructured", func(t *testing.T) {
unstructuredObj := &runtimetesting.Unstructured{}
external := &runtimetesting.ExternalSimple{
TestString: "foo",
}
// Test convert external to unstructured
unstructuredObj = &runtimetesting.Unstructured{}
err = scheme.Convert(external, unstructuredObj, nil)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if e, a := simple.TestString, unstructuredObj.Object["testString"].(string); e != a {
t.Errorf("Expected %v, got %v", e, a)
}
if e := unstructuredObj.GetObjectKind().GroupVersionKind(); !reflect.DeepEqual(e, schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) {
t.Errorf("Unexpected object kind: %#v", e)
}
// Test convert unstructured to unstructured
uIn := &runtimetesting.Unstructured{Object: map[string]interface{}{
"test": []interface{}{"other", "test"},
}}
uOut := &runtimetesting.Unstructured{}
err = scheme.Convert(uIn, uOut, nil)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if !reflect.DeepEqual(uIn.Object, uOut.Object) {
t.Errorf("Unexpected object contents: %#v", uOut.Object)
}
// Test convert unstructured to structured
externalOut := &runtimetesting.ExternalSimple{}
err = scheme.Convert(unstructuredObj, externalOut, nil)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if !reflect.DeepEqual(external, externalOut) {
t.Errorf("Unexpected object contents: %#v", externalOut)
}
// Encode and Convert should each have caused an increment.
if e, a := 3, internalToExternalCalls; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
// DecodeInto and Decode should each have caused an increment because of a conversion
if e, a := 2, externalToInternalCalls; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
// Verify that unstructured types must have V and K set
emptyObj := &runtimetesting.Unstructured{Object: make(map[string]interface{})}
if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingKind(err) {
t.Errorf("unexpected error: %v", err)
}
emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test"})
if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingVersion(err) {
t.Errorf("unexpected error: %v", err)
}
emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test", Version: "v1"})
if _, _, err := scheme.ObjectKinds(emptyObj); err != nil {
t.Errorf("unexpected error: %v", err)
}
err = scheme.Convert(external, unstructuredObj, nil)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if e, a := external.TestString, unstructuredObj.Object["testString"].(string); e != a {
t.Errorf("Expected %q, got %q", e, a)
}
if e := unstructuredObj.GetObjectKind().GroupVersionKind(); e != externalGVK {
t.Errorf("Unexpected object kind: %#v", e)
}
})
t.Run("Convert unstructured to unstructured", func(t *testing.T) {
uIn := &runtimetesting.Unstructured{Object: map[string]interface{}{
"test": []interface{}{"other", "test"},
}}
uOut := &runtimetesting.Unstructured{}
err = scheme.Convert(uIn, uOut, nil)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if !reflect.DeepEqual(uIn.Object, uOut.Object) {
t.Errorf("Unexpected object contents: %#v", uOut.Object)
}
})
t.Run("Convert unstructured to structured", func(t *testing.T) {
unstructuredObj := &runtimetesting.Unstructured{
Object: map[string]interface{}{
"testString": "bla",
},
}
unstructuredObj.SetGroupVersionKind(externalGV.WithKind("Simple"))
externalOut := &runtimetesting.ExternalSimple{}
err = scheme.Convert(unstructuredObj, externalOut, nil)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
if externalOut.TestString != "bla" {
t.Errorf("Unexpected object contents: %#v", externalOut)
}
})
t.Run("Encode and Convert should each have caused an increment", func(t *testing.T) {
if e, a := 3, internalToExternalCalls; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
})
t.Run("DecodeInto and Decode should each have caused an increment because of a conversion", func(t *testing.T) {
if e, a := 2, externalToInternalCalls; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
})
t.Run("Verify that unstructured types must have V and K set", func(t *testing.T) {
emptyObj := &runtimetesting.Unstructured{Object: make(map[string]interface{})}
if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingKind(err) {
t.Errorf("unexpected error: %v", err)
}
emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test"})
if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingVersion(err) {
t.Errorf("unexpected error: %v", err)
}
emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test", Version: "v1"})
if _, _, err := scheme.ObjectKinds(emptyObj); err != nil {
t.Errorf("unexpected error: %v", err)
}
})
}
func TestBadJSONRejection(t *testing.T) {
@ -334,11 +368,13 @@ func TestExtensionMapping(t *testing.T) {
func TestEncode(t *testing.T) {
internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
internalGVK := internalGV.WithKind("Simple")
externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"}
externalGVK := externalGV.WithKind("Simple")
scheme := runtime.NewScheme()
scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{})
scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{})
scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{})
scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{})
codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV)
@ -357,20 +393,22 @@ func TestEncode(t *testing.T) {
if !reflect.DeepEqual(obj2, test) {
t.Errorf("Expected:\n %#v,\n Got:\n %#v", test, obj2)
}
if !reflect.DeepEqual(gvk, &schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) {
t.Errorf("unexpected gvk returned by decode: %#v", gvk)
if *gvk != externalGVK {
t.Errorf("unexpected gvk returned by decode: %#v", *gvk)
}
}
func TestUnversionedTypes(t *testing.T) {
internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
internalGVK := internalGV.WithKind("Simple")
externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"}
externalGVK := externalGV.WithKind("Simple")
otherGV := schema.GroupVersion{Group: "group", Version: "other"}
scheme := runtime.NewScheme()
scheme.AddUnversionedTypes(externalGV, &runtimetesting.InternalSimple{})
scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{})
scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{})
scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{})
scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{})
scheme.AddKnownTypeWithName(otherGV.WithKind("Simple"), &runtimetesting.ExternalSimple{})
codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV)
@ -407,8 +445,8 @@ func TestUnversionedTypes(t *testing.T) {
t.Errorf("Expected:\n %#v,\n Got:\n %#v", test, obj2)
}
// object is serialized as an unversioned object (in the group and version it was defined in)
if !reflect.DeepEqual(gvk, &schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "InternalSimple"}) {
t.Errorf("unexpected gvk returned by decode: %#v", gvk)
if *gvk != externalGV.WithKind("InternalSimple") {
t.Errorf("unexpected gvk returned by decode: %#v", *gvk)
}
// when serialized to a different group, the object is kept in its preferred name
@ -435,10 +473,10 @@ var TestObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 100).Funcs(
// Returns a new Scheme set up with the test objects.
func GetTestScheme() *runtime.Scheme {
internalGV := schema.GroupVersion{Version: "__internal"}
internalGV := schema.GroupVersion{Version: runtime.APIVersionInternal}
externalGV := schema.GroupVersion{Version: "v1"}
alternateExternalGV := schema.GroupVersion{Group: "custom", Version: "v1"}
alternateInternalGV := schema.GroupVersion{Group: "custom", Version: "__internal"}
alternateInternalGV := schema.GroupVersion{Group: "custom", Version: runtime.APIVersionInternal}
differentExternalGV := schema.GroupVersion{Group: "other", Version: "v2"}
s := runtime.NewScheme()
@ -614,7 +652,7 @@ func TestConvertToVersion(t *testing.T) {
{
scheme: GetTestScheme(),
in: &runtimetesting.ExternalTestType1{A: "test"},
gv: schema.GroupVersion{Version: "__internal"},
gv: schema.GroupVersion{Version: runtime.APIVersionInternal},
out: &runtimetesting.TestType1{A: "test"},
},
// converts from unstructured to internal
@ -625,7 +663,7 @@ func TestConvertToVersion(t *testing.T) {
"kind": "TestType3",
"A": "test",
}},
gv: schema.GroupVersion{Version: "__internal"},
gv: schema.GroupVersion{Version: runtime.APIVersionInternal},
out: &runtimetesting.TestType1{A: "test"},
},
// converts from unstructured to external
@ -643,7 +681,7 @@ func TestConvertToVersion(t *testing.T) {
{
scheme: GetTestScheme(),
in: &runtimetesting.ExternalTestType1{A: "test"},
gv: schema.GroupVersions{{Version: "__internal"}, {Version: "v1"}},
gv: schema.GroupVersions{{Version: runtime.APIVersionInternal}, {Version: "v1"}},
out: &runtimetesting.ExternalTestType1{
MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
A: "test",
@ -686,7 +724,7 @@ func TestConvertToVersion(t *testing.T) {
{
scheme: GetTestScheme(),
in: &runtimetesting.ExternalTestType1{A: "test"},
gv: schema.GroupVersions{{Version: "v1"}, {Version: "__internal"}},
gv: schema.GroupVersions{{Version: "v1"}, {Version: runtime.APIVersionInternal}},
same: true,
out: &runtimetesting.ExternalTestType1{
MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
@ -697,7 +735,7 @@ func TestConvertToVersion(t *testing.T) {
{
scheme: GetTestScheme(),
in: &runtimetesting.ExternalTestType1{A: "test"},
gv: schema.GroupVersions{{Version: "v1"}, {Version: "__internal"}},
gv: schema.GroupVersions{{Version: "v1"}, {Version: runtime.APIVersionInternal}},
same: true,
out: &runtimetesting.ExternalTestType1{
MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"},
@ -896,7 +934,7 @@ func TestConvert(t *testing.T) {
}
func TestMetaValues(t *testing.T) {
internalGV := schema.GroupVersion{Group: "test.group", Version: "__internal"}
internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal}
externalGV := schema.GroupVersion{Group: "test.group", Version: "externalVersion"}
s := runtime.NewScheme()

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["codec_test.go"],
importpath = "k8s.io/apimachinery/pkg/runtime/serializer",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//vendor/github.com/ghodss/yaml:go_default_library",
"//vendor/github.com/google/gofuzz:go_default_library",

View File

@ -9,8 +9,7 @@ load(
go_test(
name = "go_default_test",
srcs = ["meta_test.go"],
importpath = "k8s.io/apimachinery/pkg/runtime/serializer/json",
library = ":go_default_library",
embed = [":go_default_library"],
)
go_library(
@ -34,7 +33,6 @@ go_library(
go_test(
name = "go_default_xtest",
srcs = ["json_test.go"],
importpath = "k8s.io/apimachinery/pkg/runtime/serializer/json_test",
deps = [
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -98,11 +98,29 @@ func init() {
jsoniter.RegisterTypeDecoderFunc("interface {}", decodeNumberAsInt64IfPossible)
}
// gvkWithDefaults returns group kind and version defaulting from provided default
func gvkWithDefaults(actual, defaultGVK schema.GroupVersionKind) schema.GroupVersionKind {
if len(actual.Kind) == 0 {
actual.Kind = defaultGVK.Kind
}
if len(actual.Version) == 0 && len(actual.Group) == 0 {
actual.Group = defaultGVK.Group
actual.Version = defaultGVK.Version
}
if len(actual.Version) == 0 && actual.Group == defaultGVK.Group {
actual.Version = defaultGVK.Version
}
return actual
}
// Decode attempts to convert the provided data into YAML or JSON, extract the stored schema kind, apply the provided default gvk, and then
// load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown, the raw data will be
// extracted and no decoding will be performed. If into is not registered with the typer, then the object will be straight decoded using
// normal JSON/YAML unmarshalling. If into is provided and the original data is not fully qualified with kind/version/group, the type of
// the into will be used to alter the returned gvk. On success or most errors, the method will return the calculated schema kind.
// load that data into an object matching the desired schema kind or the provided into.
// If into is *runtime.Unknown, the raw data will be extracted and no decoding will be performed.
// If into is not registered with the typer, then the object will be straight decoded using normal JSON/YAML unmarshalling.
// If into is provided and the original data is not fully qualified with kind/version/group, the type of the into will be used to alter the returned gvk.
// If into is nil or data's gvk different from into's gvk, it will generate a new Object with ObjectCreater.New(gvk)
// On success or most errors, the method will return the calculated schema kind.
// The gvk calculate priority will be originalData > default gvk > into
func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
if versioned, ok := into.(*runtime.VersionedObjects); ok {
into = versioned.Last()
@ -129,17 +147,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
}
if gvk != nil {
// apply kind and version defaulting from provided default
if len(actual.Kind) == 0 {
actual.Kind = gvk.Kind
}
if len(actual.Version) == 0 && len(actual.Group) == 0 {
actual.Group = gvk.Group
actual.Version = gvk.Version
}
if len(actual.Version) == 0 && actual.Group == gvk.Group {
actual.Version = gvk.Version
}
*actual = gvkWithDefaults(*actual, *gvk)
}
if unk, ok := into.(*runtime.Unknown); ok && unk != nil {
@ -154,24 +162,14 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
types, _, err := s.typer.ObjectKinds(into)
switch {
case runtime.IsNotRegisteredError(err), isUnstructured:
if err := jsoniter.ConfigFastest.Unmarshal(data, into); err != nil {
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(data, into); err != nil {
return nil, actual, err
}
return into, actual, nil
case err != nil:
return nil, actual, err
default:
typed := types[0]
if len(actual.Kind) == 0 {
actual.Kind = typed.Kind
}
if len(actual.Version) == 0 && len(actual.Group) == 0 {
actual.Group = typed.Group
actual.Version = typed.Version
}
if len(actual.Version) == 0 && actual.Group == typed.Group {
actual.Version = typed.Version
}
*actual = gvkWithDefaults(*actual, types[0])
}
}
@ -188,7 +186,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
return nil, actual, err
}
if err := jsoniter.ConfigFastest.Unmarshal(data, obj); err != nil {
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(data, obj); err != nil {
return nil, actual, err
}
return obj, actual, nil
@ -197,7 +195,7 @@ func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, i
// Encode serializes the provided object to the given writer.
func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
if s.yaml {
json, err := jsoniter.ConfigFastest.Marshal(obj)
json, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(obj)
if err != nil {
return err
}
@ -210,7 +208,7 @@ func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error {
}
if s.pretty {
data, err := jsoniter.ConfigFastest.MarshalIndent(obj, "", " ")
data, err := jsoniter.ConfigCompatibleWithStandardLibrary.MarshalIndent(obj, "", " ")
if err != nil {
return err
}

Some files were not shown because too many files have changed in this diff Show More