Commit 33b20f22 authored by Dr. Stefan Schimanski's avatar Dr. Stefan Schimanski

pkg/apis/core: fixup package names

parent 3848e0a4
...@@ -10,22 +10,15 @@ cmd/kubelet/app ...@@ -10,22 +10,15 @@ cmd/kubelet/app
cmd/kubelet/app/options cmd/kubelet/app/options
cmd/kubemark cmd/kubemark
examples/guestbook-go examples/guestbook-go
pkg/api
pkg/api/endpoints pkg/api/endpoints
pkg/api/helper
pkg/api/helper/qos
pkg/api/ref pkg/api/ref
pkg/api/testapi pkg/api/testapi
pkg/api/testing pkg/api/testing
pkg/api/testing/compat pkg/api/testing/compat
pkg/api/unversioned pkg/api/unversioned
pkg/api/v1/endpoints pkg/api/v1/endpoints
pkg/api/v1/helper
pkg/api/v1/helper/qos
pkg/api/v1/pod pkg/api/v1/pod
pkg/api/v1/resource pkg/api/v1/resource
pkg/api/v1/validation
pkg/api/validation
pkg/apis/abac pkg/apis/abac
pkg/apis/abac/latest pkg/apis/abac/latest
pkg/apis/admission pkg/apis/admission
...@@ -51,6 +44,13 @@ pkg/apis/certificates/v1beta1 ...@@ -51,6 +44,13 @@ pkg/apis/certificates/v1beta1
pkg/apis/certificates/validation pkg/apis/certificates/validation
pkg/apis/componentconfig pkg/apis/componentconfig
pkg/apis/componentconfig/v1alpha1 pkg/apis/componentconfig/v1alpha1
pkg/apis/core
pkg/apis/core/helper
pkg/apis/core/helper/qos
pkg/apis/core/v1/helper
pkg/apis/core/v1/helper/qos
pkg/apis/core/v1/validation
pkg/apis/core/validation
pkg/apis/extensions pkg/apis/extensions
pkg/apis/extensions/validation pkg/apis/extensions/validation
pkg/apis/imagepolicy pkg/apis/imagepolicy
......
...@@ -43,8 +43,7 @@ find_files() { ...@@ -43,8 +43,7 @@ find_files() {
-o -wholename '*/vendor/*' \ -o -wholename '*/vendor/*' \
\) -prune \ \) -prune \
\) \ \) \
\( -wholename '*pkg/api/v*/types.go' \ \( -wholename '*pkg/apis/*/v*/types.go' \
-o -wholename '*pkg/apis/*/v*/types.go' \
-o -wholename '*pkg/api/unversioned/types.go' \ -o -wholename '*pkg/api/unversioned/types.go' \
\) \)
} }
...@@ -71,7 +70,7 @@ for file in $versioned_api_files; do ...@@ -71,7 +70,7 @@ for file in $versioned_api_files; do
fi fi
done done
internal_types_files="${KUBE_ROOT}/pkg/api/types.go ${KUBE_ROOT}/pkg/apis/extensions/types.go" internal_types_files="${KUBE_ROOT}/pkg/apis/core/types.go ${KUBE_ROOT}/pkg/apis/extensions/types.go"
for internal_types_file in $internal_types_files; do for internal_types_file in $internal_types_files; do
if [[ ! -e $internal_types_file ]]; then if [[ ! -e $internal_types_file ]]; then
echo "Internal types file ${internal_types_file} does not exist" echo "Internal types file ${internal_types_file} does not exist"
......
...@@ -16,7 +16,7 @@ limitations under the License. ...@@ -16,7 +16,7 @@ limitations under the License.
// This file should be consistent with pkg/api/v1/annotation_key_constants.go. // This file should be consistent with pkg/api/v1/annotation_key_constants.go.
package api package core
const ( const (
// ImagePolicyFailedOpenKey is added to pods created by failing open when the image policy // ImagePolicyFailedOpenKey is added to pods created by failing open when the image policy
......
...@@ -21,4 +21,4 @@ limitations under the License. ...@@ -21,4 +21,4 @@ limitations under the License.
// The contract presented to clients is located in the versioned packages, // The contract presented to clients is located in the versioned packages,
// which are sub-directories. The first one is "v1". Those packages // which are sub-directories. The first one is "v1". Those packages
// describe how a particular version is serialized to storage/network. // describe how a particular version is serialized to storage/network.
package api // import "k8s.io/kubernetes/pkg/api" package core // import "k8s.io/kubernetes/pkg/apis/core"
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package api package core
// Field path constants that are specific to the internal API // Field path constants that are specific to the internal API
// representation. // representation.
......
...@@ -21,12 +21,12 @@ package qos ...@@ -21,12 +21,12 @@ package qos
import ( import (
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/api/helper" "k8s.io/kubernetes/pkg/apis/core/helper"
) )
func isSupportedQoSComputeResource(name api.ResourceName) bool { func isSupportedQoSComputeResource(name core.ResourceName) bool {
supportedQoSComputeResources := sets.NewString(string(api.ResourceCPU), string(api.ResourceMemory)) supportedQoSComputeResources := sets.NewString(string(core.ResourceCPU), string(core.ResourceMemory))
return supportedQoSComputeResources.Has(string(name)) || helper.IsHugePageResourceName(name) return supportedQoSComputeResources.Has(string(name)) || helper.IsHugePageResourceName(name)
} }
...@@ -34,9 +34,9 @@ func isSupportedQoSComputeResource(name api.ResourceName) bool { ...@@ -34,9 +34,9 @@ func isSupportedQoSComputeResource(name api.ResourceName) bool {
// A pod is besteffort if none of its containers have specified any requests or limits. // A pod is besteffort if none of its containers have specified any requests or limits.
// A pod is guaranteed only when requests and limits are specified for all the containers and they are equal. // A pod is guaranteed only when requests and limits are specified for all the containers and they are equal.
// A pod is burstable if limits and requests do not match across all containers. // A pod is burstable if limits and requests do not match across all containers.
func GetPodQOS(pod *api.Pod) api.PodQOSClass { func GetPodQOS(pod *core.Pod) core.PodQOSClass {
requests := api.ResourceList{} requests := core.ResourceList{}
limits := api.ResourceList{} limits := core.ResourceList{}
zeroQuantity := resource.MustParse("0") zeroQuantity := resource.MustParse("0")
isGuaranteed := true isGuaranteed := true
for _, container := range pod.Spec.Containers { for _, container := range pod.Spec.Containers {
...@@ -73,12 +73,12 @@ func GetPodQOS(pod *api.Pod) api.PodQOSClass { ...@@ -73,12 +73,12 @@ func GetPodQOS(pod *api.Pod) api.PodQOSClass {
} }
} }
if !qosLimitsFound.HasAll(string(api.ResourceMemory), string(api.ResourceCPU)) { if !qosLimitsFound.HasAll(string(core.ResourceMemory), string(core.ResourceCPU)) {
isGuaranteed = false isGuaranteed = false
} }
} }
if len(requests) == 0 && len(limits) == 0 { if len(requests) == 0 && len(limits) == 0 {
return api.PodQOSBestEffort return core.PodQOSBestEffort
} }
// Check is requests match limits for all resources. // Check is requests match limits for all resources.
if isGuaranteed { if isGuaranteed {
...@@ -91,7 +91,7 @@ func GetPodQOS(pod *api.Pod) api.PodQOSClass { ...@@ -91,7 +91,7 @@ func GetPodQOS(pod *api.Pod) api.PodQOSClass {
} }
if isGuaranteed && if isGuaranteed &&
len(requests) == len(limits) { len(requests) == len(limits) {
return api.PodQOSGuaranteed return core.PodQOSGuaranteed
} }
return api.PodQOSBurstable return core.PodQOSBurstable
} }
...@@ -23,9 +23,9 @@ import ( ...@@ -23,9 +23,9 @@ import (
"k8s.io/apimachinery/pkg/apimachinery/registered" "k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/core/v1"
) )
func init() { func init() {
...@@ -36,9 +36,9 @@ func init() { ...@@ -36,9 +36,9 @@ func init() {
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) { func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
if err := announced.NewGroupMetaFactory( if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{ &announced.GroupMetaFactoryArgs{
GroupName: api.GroupName, GroupName: core.GroupName,
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version}, VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version},
AddInternalObjectsToScheme: api.AddToScheme, AddInternalObjectsToScheme: core.AddToScheme,
RootScopedKinds: sets.NewString( RootScopedKinds: sets.NewString(
"Node", "Node",
"Namespace", "Namespace",
......
...@@ -25,8 +25,8 @@ import ( ...@@ -25,8 +25,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
internal "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/legacyscheme"
internal "k8s.io/kubernetes/pkg/apis/core"
) )
func TestResourceVersioner(t *testing.T) { func TestResourceVersioner(t *testing.T) {
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package api package core
import "encoding/json" import "encoding/json"
......
...@@ -17,7 +17,7 @@ limitations under the License. ...@@ -17,7 +17,7 @@ limitations under the License.
//TODO: consider making these methods functions, because we don't want helper //TODO: consider making these methods functions, because we don't want helper
//functions in the k8s.io/api repo. //functions in the k8s.io/api repo.
package api package core
import ( import (
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package api package core
import ( import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package api package core
import ( import (
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
......
...@@ -17,7 +17,7 @@ limitations under the License. ...@@ -17,7 +17,7 @@ limitations under the License.
//TODO: consider making these methods functions, because we don't want helper //TODO: consider making these methods functions, because we don't want helper
//functions in the k8s.io/api repo. //functions in the k8s.io/api repo.
package api package core
import "fmt" import "fmt"
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package api package core
import "testing" import "testing"
......
...@@ -17,7 +17,7 @@ limitations under the License. ...@@ -17,7 +17,7 @@ limitations under the License.
//TODO: consider making these methods functions, because we don't want helper //TODO: consider making these methods functions, because we don't want helper
//functions in the k8s.io/api repo. //functions in the k8s.io/api repo.
package api package core
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>, // MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
// if the two tolerations have same <key,effect,operator,value> combination, regard as they match. // if the two tolerations have same <key,effect,operator,value> combination, regard as they match.
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package api package core
import ( import (
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
......
...@@ -32,10 +32,10 @@ import ( ...@@ -32,10 +32,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/diff" "k8s.io/apimachinery/pkg/util/diff"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/legacyscheme"
kapitesting "k8s.io/kubernetes/pkg/api/testing" kapitesting "k8s.io/kubernetes/pkg/api/testing"
k8s_api_v1 "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/apis/core"
corev1 "k8s.io/kubernetes/pkg/apis/core/v1"
"k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/extensions"
utilpointer "k8s.io/kubernetes/pkg/util/pointer" utilpointer "k8s.io/kubernetes/pkg/util/pointer"
...@@ -59,7 +59,7 @@ func TestPodLogOptions(t *testing.T) { ...@@ -59,7 +59,7 @@ func TestPodLogOptions(t *testing.T) {
TailLines: &tailLines, TailLines: &tailLines,
LimitBytes: &limitBytes, LimitBytes: &limitBytes,
} }
unversionedLogOptions := &api.PodLogOptions{ unversionedLogOptions := &core.PodLogOptions{
Container: "mycontainer", Container: "mycontainer",
Follow: true, Follow: true,
Previous: true, Previous: true,
...@@ -118,7 +118,7 @@ func TestPodLogOptions(t *testing.T) { ...@@ -118,7 +118,7 @@ func TestPodLogOptions(t *testing.T) {
// query params -> unversioned // query params -> unversioned
{ {
convertedLogOptions := &api.PodLogOptions{} convertedLogOptions := &core.PodLogOptions{}
err := codec.DecodeParameters(expectedParameters, v1.SchemeGroupVersion, convertedLogOptions) err := codec.DecodeParameters(expectedParameters, v1.SchemeGroupVersion, convertedLogOptions)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
...@@ -136,7 +136,7 @@ func TestPodSpecConversion(t *testing.T) { ...@@ -136,7 +136,7 @@ func TestPodSpecConversion(t *testing.T) {
// Test internal -> v1. Should have both alias (DeprecatedServiceAccount) // Test internal -> v1. Should have both alias (DeprecatedServiceAccount)
// and new field (ServiceAccountName). // and new field (ServiceAccountName).
i := &api.PodSpec{ i := &core.PodSpec{
ServiceAccountName: name, ServiceAccountName: name,
} }
v := v1.PodSpec{} v := v1.PodSpec{}
...@@ -164,13 +164,13 @@ func TestPodSpecConversion(t *testing.T) { ...@@ -164,13 +164,13 @@ func TestPodSpecConversion(t *testing.T) {
{ServiceAccountName: name, DeprecatedServiceAccount: other}, {ServiceAccountName: name, DeprecatedServiceAccount: other},
} }
for k, v := range testCases { for k, v := range testCases {
got := api.PodSpec{} got := core.PodSpec{}
err := legacyscheme.Scheme.Convert(v, &got, nil) err := legacyscheme.Scheme.Convert(v, &got, nil)
if err != nil { if err != nil {
t.Fatalf("unexpected error for case %d: %v", k, err) t.Fatalf("unexpected error for case %d: %v", k, err)
} }
if got.ServiceAccountName != name { if got.ServiceAccountName != name {
t.Fatalf("want api.ServiceAccountName %q, got %q", name, got.ServiceAccountName) t.Fatalf("want core.ServiceAccountName %q, got %q", name, got.ServiceAccountName)
} }
} }
} }
...@@ -181,7 +181,7 @@ func TestResourceListConversion(t *testing.T) { ...@@ -181,7 +181,7 @@ func TestResourceListConversion(t *testing.T) {
tests := []struct { tests := []struct {
input v1.ResourceList input v1.ResourceList
expected api.ResourceList expected core.ResourceList
}{ }{
{ // No changes necessary. { // No changes necessary.
input: v1.ResourceList{ input: v1.ResourceList{
...@@ -189,10 +189,10 @@ func TestResourceListConversion(t *testing.T) { ...@@ -189,10 +189,10 @@ func TestResourceListConversion(t *testing.T) {
v1.ResourceCPU: resource.MustParse("100m"), v1.ResourceCPU: resource.MustParse("100m"),
v1.ResourceStorage: resource.MustParse("1G"), v1.ResourceStorage: resource.MustParse("1G"),
}, },
expected: api.ResourceList{ expected: core.ResourceList{
api.ResourceMemory: resource.MustParse("30M"), core.ResourceMemory: resource.MustParse("30M"),
api.ResourceCPU: resource.MustParse("100m"), core.ResourceCPU: resource.MustParse("100m"),
api.ResourceStorage: resource.MustParse("1G"), core.ResourceStorage: resource.MustParse("1G"),
}, },
}, },
{ // Nano-scale values should be rounded up to milli-scale. { // Nano-scale values should be rounded up to milli-scale.
...@@ -200,9 +200,9 @@ func TestResourceListConversion(t *testing.T) { ...@@ -200,9 +200,9 @@ func TestResourceListConversion(t *testing.T) {
v1.ResourceCPU: resource.MustParse("3.000023m"), v1.ResourceCPU: resource.MustParse("3.000023m"),
v1.ResourceMemory: resource.MustParse("500.000050m"), v1.ResourceMemory: resource.MustParse("500.000050m"),
}, },
expected: api.ResourceList{ expected: core.ResourceList{
api.ResourceCPU: resource.MustParse("4m"), core.ResourceCPU: resource.MustParse("4m"),
api.ResourceMemory: resource.MustParse("501m"), core.ResourceMemory: resource.MustParse("501m"),
}, },
}, },
{ // Large values should still be accurate. { // Large values should still be accurate.
...@@ -210,19 +210,19 @@ func TestResourceListConversion(t *testing.T) { ...@@ -210,19 +210,19 @@ func TestResourceListConversion(t *testing.T) {
v1.ResourceCPU: *bigMilliQuantity.Copy(), v1.ResourceCPU: *bigMilliQuantity.Copy(),
v1.ResourceStorage: *bigMilliQuantity.Copy(), v1.ResourceStorage: *bigMilliQuantity.Copy(),
}, },
expected: api.ResourceList{ expected: core.ResourceList{
api.ResourceCPU: *bigMilliQuantity.Copy(), core.ResourceCPU: *bigMilliQuantity.Copy(),
api.ResourceStorage: *bigMilliQuantity.Copy(), core.ResourceStorage: *bigMilliQuantity.Copy(),
}, },
}, },
} }
for i, test := range tests { for i, test := range tests {
output := api.ResourceList{} output := core.ResourceList{}
// defaulting is a separate step from conversion that is applied when reading from the API or from etcd. // defaulting is a separate step from conversion that is applied when reading from the API or from etcd.
// perform that step explicitly. // perform that step explicitly.
k8s_api_v1.SetDefaults_ResourceList(&test.input) corev1.SetDefaults_ResourceList(&test.input)
err := legacyscheme.Scheme.Convert(&test.input, &output, nil) err := legacyscheme.Scheme.Convert(&test.input, &output, nil)
if err != nil { if err != nil {
...@@ -306,14 +306,14 @@ func TestReplicationControllerConversion(t *testing.T) { ...@@ -306,14 +306,14 @@ func TestReplicationControllerConversion(t *testing.T) {
for _, in := range inputs { for _, in := range inputs {
rs := &extensions.ReplicaSet{} rs := &extensions.ReplicaSet{}
// Use in.DeepCopy() to avoid sharing pointers with `in`. // Use in.DeepCopy() to avoid sharing pointers with `in`.
if err := k8s_api_v1.Convert_v1_ReplicationController_to_extensions_ReplicaSet(in.DeepCopy(), rs, nil); err != nil { if err := corev1.Convert_v1_ReplicationController_to_extensions_ReplicaSet(in.DeepCopy(), rs, nil); err != nil {
t.Errorf("can't convert RC to RS: %v", err) t.Errorf("can't convert RC to RS: %v", err)
continue continue
} }
// Round-trip RS before converting back to RC. // Round-trip RS before converting back to RC.
rs = roundTripRS(t, rs) rs = roundTripRS(t, rs)
out := &v1.ReplicationController{} out := &v1.ReplicationController{}
if err := k8s_api_v1.Convert_extensions_ReplicaSet_to_v1_ReplicationController(rs, out, nil); err != nil { if err := corev1.Convert_extensions_ReplicaSet_to_v1_ReplicationController(rs, out, nil); err != nil {
t.Errorf("can't convert RS to RC: %v", err) t.Errorf("can't convert RS to RC: %v", err)
continue continue
} }
......
...@@ -27,14 +27,14 @@ import ( ...@@ -27,14 +27,14 @@ import (
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/legacyscheme"
k8s_api_v1 "k8s.io/kubernetes/pkg/api/v1" corev1 "k8s.io/kubernetes/pkg/apis/core/v1"
// enforce that all types are installed // enforce that all types are installed
_ "k8s.io/kubernetes/pkg/api/testapi" _ "k8s.io/kubernetes/pkg/api/testapi"
) )
func roundTrip(t *testing.T, obj runtime.Object) runtime.Object { func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
codec := legacyscheme.Codecs.LegacyCodec(v1.SchemeGroupVersion) codec := legacyscheme.Codecs.LegacyCodec(corev1.SchemeGroupVersion)
data, err := runtime.Encode(codec, obj) data, err := runtime.Encode(codec, obj)
if err != nil { if err != nil {
t.Errorf("%v\n %#v", err, obj) t.Errorf("%v\n %#v", err, obj)
...@@ -1129,7 +1129,7 @@ func TestSetMinimumScalePod(t *testing.T) { ...@@ -1129,7 +1129,7 @@ func TestSetMinimumScalePod(t *testing.T) {
pod := &v1.Pod{ pod := &v1.Pod{
Spec: s, Spec: s,
} }
k8s_api_v1.SetObjectDefaults_Pod(pod) corev1.SetObjectDefaults_Pod(pod)
if expect := resource.MustParse("1m"); expect.Cmp(pod.Spec.Containers[0].Resources.Requests[v1.ResourceMemory]) != 0 { if expect := resource.MustParse("1m"); expect.Cmp(pod.Spec.Containers[0].Resources.Requests[v1.ResourceMemory]) != 0 {
t.Errorf("did not round resources: %#v", pod.Spec.Containers[0].Resources) t.Errorf("did not round resources: %#v", pod.Spec.Containers[0].Resources)
......
...@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and ...@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/api // +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/core
// +k8s:conversion-gen-external-types=../../../vendor/k8s.io/api/core/v1 // +k8s:conversion-gen-external-types=../../../../vendor/k8s.io/api/core/v1
// +k8s:defaulter-gen=TypeMeta // +k8s:defaulter-gen=TypeMeta
// +k8s:defaulter-gen-input=../../../vendor/k8s.io/api/core/v1 // +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/core/v1
// Package v1 is the v1 version of the API. // Package v1 is the v1 version of the API.
package v1 // import "k8s.io/kubernetes/pkg/api/v1" package v1 // import "k8s.io/kubernetes/pkg/apis/core/v1"
...@@ -26,7 +26,7 @@ import ( ...@@ -26,7 +26,7 @@ import (
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection" "k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/pkg/api/helper" "k8s.io/kubernetes/pkg/apis/core/helper"
) )
// IsExtendedResourceName returns true if the resource name is not in the // IsExtendedResourceName returns true if the resource name is not in the
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
v1helper "k8s.io/kubernetes/pkg/api/v1/helper" v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
) )
// QOSList is a set of (resource name, QoS class) pairs. // QOSList is a set of (resource name, QoS class) pairs.
......
...@@ -22,9 +22,9 @@ import ( ...@@ -22,9 +22,9 @@ import (
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/api/helper/qos" "k8s.io/kubernetes/pkg/apis/core/helper/qos"
k8sv1 "k8s.io/kubernetes/pkg/api/v1" corev1 "k8s.io/kubernetes/pkg/apis/core/v1"
) )
func TestGetPodQOS(t *testing.T) { func TestGetPodQOS(t *testing.T) {
...@@ -142,11 +142,11 @@ func TestGetPodQOS(t *testing.T) { ...@@ -142,11 +142,11 @@ func TestGetPodQOS(t *testing.T) {
t.Errorf("[%d]: invalid qos pod %s, expected: %s, actual: %s", id, testCase.pod.Name, testCase.expected, actual) t.Errorf("[%d]: invalid qos pod %s, expected: %s, actual: %s", id, testCase.pod.Name, testCase.expected, actual)
} }
// Convert v1.Pod to api.Pod, and then check against `api.helper.GetPodQOS`. // Convert v1.Pod to core.Pod, and then check against `core.helper.GetPodQOS`.
pod := api.Pod{} pod := core.Pod{}
k8sv1.Convert_v1_Pod_To_api_Pod(testCase.pod, &pod, nil) corev1.Convert_v1_Pod_To_api_Pod(testCase.pod, &pod, nil)
if actual := qos.GetPodQOS(&pod); api.PodQOSClass(testCase.expected) != actual { if actual := qos.GetPodQOS(&pod); core.PodQOSClass(testCase.expected) != actual {
t.Errorf("[%d]: conversion invalid qos pod %s, expected: %s, actual: %s", id, testCase.pod.Name, testCase.expected, actual) t.Errorf("[%d]: conversion invalid qos pod %s, expected: %s, actual: %s", id, testCase.pod.Name, testCase.expected, actual)
} }
} }
......
...@@ -27,8 +27,8 @@ import ( ...@@ -27,8 +27,8 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation" "k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/api/helper" "k8s.io/kubernetes/pkg/apis/core/helper"
v1helper "k8s.io/kubernetes/pkg/api/v1/helper" v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
) )
const isNegativeErrorMsg string = `must be greater than or equal to 0` const isNegativeErrorMsg string = `must be greater than or equal to 0`
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,4 +16,4 @@ limitations under the License. ...@@ -16,4 +16,4 @@ limitations under the License.
// Package validation has functions for validating the correctness of api // Package validation has functions for validating the correctness of api
// objects and explaining what is wrong with them when they aren't valid. // objects and explaining what is wrong with them when they aren't valid.
package validation // import "k8s.io/kubernetes/pkg/api/validation" package validation // import "k8s.io/kubernetes/pkg/apis/core/validation"
...@@ -24,12 +24,12 @@ import ( ...@@ -24,12 +24,12 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation" "k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/core"
) )
// ValidateEvent makes sure that the event makes sense. // ValidateEvent makes sure that the event makes sense.
func ValidateEvent(event *api.Event) field.ErrorList { func ValidateEvent(event *core.Event) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
// Make sure event.Namespace and the involvedObject.Namespace agree // Make sure event.Namespace and the involvedObject.Namespace agree
......
...@@ -20,69 +20,69 @@ import ( ...@@ -20,69 +20,69 @@ import (
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/core"
) )
func TestValidateEvent(t *testing.T) { func TestValidateEvent(t *testing.T) {
table := []struct { table := []struct {
*api.Event *core.Event
valid bool valid bool
}{ }{
{ {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test1", Name: "test1",
Namespace: "foo", Namespace: "foo",
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
Namespace: "bar", Namespace: "bar",
Kind: "Pod", Kind: "Pod",
}, },
}, },
false, false,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test2", Name: "test2",
Namespace: "aoeu-_-aoeu", Namespace: "aoeu-_-aoeu",
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
Namespace: "aoeu-_-aoeu", Namespace: "aoeu-_-aoeu",
Kind: "Pod", Kind: "Pod",
}, },
}, },
false, false,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test3", Name: "test3",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "v1", APIVersion: "v1",
Kind: "Node", Kind: "Node",
}, },
}, },
true, true,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test4", Name: "test4",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "v1", APIVersion: "v1",
Kind: "Namespace", Kind: "Namespace",
}, },
}, },
true, true,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test5", Name: "test5",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "extensions/v1beta1", APIVersion: "extensions/v1beta1",
Kind: "NoKind", Kind: "NoKind",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
...@@ -90,12 +90,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -90,12 +90,12 @@ func TestValidateEvent(t *testing.T) {
}, },
true, true,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test6", Name: "test6",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "extensions/v1beta1", APIVersion: "extensions/v1beta1",
Kind: "Job", Kind: "Job",
Namespace: "foo", Namespace: "foo",
...@@ -103,12 +103,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -103,12 +103,12 @@ func TestValidateEvent(t *testing.T) {
}, },
false, false,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test7", Name: "test7",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "extensions/v1beta1", APIVersion: "extensions/v1beta1",
Kind: "Job", Kind: "Job",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
...@@ -116,12 +116,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -116,12 +116,12 @@ func TestValidateEvent(t *testing.T) {
}, },
true, true,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test8", Name: "test8",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "other/v1beta1", APIVersion: "other/v1beta1",
Kind: "Job", Kind: "Job",
Namespace: "foo", Namespace: "foo",
...@@ -129,12 +129,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -129,12 +129,12 @@ func TestValidateEvent(t *testing.T) {
}, },
false, false,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test9", Name: "test9",
Namespace: "foo", Namespace: "foo",
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "other/v1beta1", APIVersion: "other/v1beta1",
Kind: "Job", Kind: "Job",
Namespace: "foo", Namespace: "foo",
...@@ -142,12 +142,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -142,12 +142,12 @@ func TestValidateEvent(t *testing.T) {
}, },
true, true,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test10", Name: "test10",
Namespace: metav1.NamespaceDefault, Namespace: metav1.NamespaceDefault,
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "extensions", APIVersion: "extensions",
Kind: "Job", Kind: "Job",
Namespace: "foo", Namespace: "foo",
...@@ -155,12 +155,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -155,12 +155,12 @@ func TestValidateEvent(t *testing.T) {
}, },
false, false,
}, { }, {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test11", Name: "test11",
Namespace: "foo", Namespace: "foo",
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
// must register in v1beta1 to be true // must register in v1beta1 to be true
APIVersion: "extensions/v1beta1", APIVersion: "extensions/v1beta1",
Kind: "Job", Kind: "Job",
...@@ -170,12 +170,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -170,12 +170,12 @@ func TestValidateEvent(t *testing.T) {
true, true,
}, },
{ {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test12", Name: "test12",
Namespace: "foo", Namespace: "foo",
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "other/v1beta1", APIVersion: "other/v1beta1",
Kind: "FooBar", Kind: "FooBar",
Namespace: "bar", Namespace: "bar",
...@@ -184,12 +184,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -184,12 +184,12 @@ func TestValidateEvent(t *testing.T) {
false, false,
}, },
{ {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test13", Name: "test13",
Namespace: "", Namespace: "",
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "other/v1beta1", APIVersion: "other/v1beta1",
Kind: "FooBar", Kind: "FooBar",
Namespace: "bar", Namespace: "bar",
...@@ -198,12 +198,12 @@ func TestValidateEvent(t *testing.T) { ...@@ -198,12 +198,12 @@ func TestValidateEvent(t *testing.T) {
false, false,
}, },
{ {
&api.Event{ &core.Event{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test14", Name: "test14",
Namespace: "foo", Namespace: "foo",
}, },
InvolvedObject: api.ObjectReference{ InvolvedObject: core.ObjectReference{
APIVersion: "other/v1beta1", APIVersion: "other/v1beta1",
Kind: "FooBar", Kind: "FooBar",
Namespace: "", Namespace: "",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -18,7 +18,7 @@ limitations under the License. ...@@ -18,7 +18,7 @@ limitations under the License.
// This file was autogenerated by deepcopy-gen. Do not edit it manually! // This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api package core
import ( import (
resource "k8s.io/apimachinery/pkg/api/resource" resource "k8s.io/apimachinery/pkg/api/resource"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment