Move APIs and core code to use metav1.ObjectMeta

This commit is contained in:
Clayton Coleman
2017-01-11 15:28:46 -05:00
parent 54d8ed001d
commit 36acd90aba
104 changed files with 486 additions and 865 deletions

View File

@@ -20,9 +20,9 @@ import (
"fmt"
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/pkg/api"
)
func RoleRefGroupKind(roleRef RoleRef) schema.GroupKind {
@@ -208,7 +208,7 @@ type ClusterRoleBindingBuilder struct {
func NewClusterBinding(clusterRoleName string) *ClusterRoleBindingBuilder {
return &ClusterRoleBindingBuilder{
ClusterRoleBinding: ClusterRoleBinding{
ObjectMeta: api.ObjectMeta{Name: clusterRoleName},
ObjectMeta: metav1.ObjectMeta{Name: clusterRoleName},
RoleRef: RoleRef{
APIGroup: GroupName,
Kind: "ClusterRole",

View File

@@ -19,7 +19,6 @@ package rbac
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api"
)
// Authorization is calculated against
@@ -94,7 +93,7 @@ type RoleRef struct {
type Role struct {
metav1.TypeMeta
// Standard object's metadata.
api.ObjectMeta
metav1.ObjectMeta
// Rules holds all the PolicyRules for this Role
Rules []PolicyRule
@@ -107,7 +106,7 @@ type Role struct {
// namespace only have effect in that namespace.
type RoleBinding struct {
metav1.TypeMeta
api.ObjectMeta
metav1.ObjectMeta
// Subjects holds references to the objects the role applies to.
Subjects []Subject
@@ -144,7 +143,7 @@ type RoleList struct {
type ClusterRole struct {
metav1.TypeMeta
// Standard object's metadata.
api.ObjectMeta
metav1.ObjectMeta
// Rules holds all the PolicyRules for this ClusterRole
Rules []PolicyRule
@@ -158,7 +157,7 @@ type ClusterRole struct {
type ClusterRoleBinding struct {
metav1.TypeMeta
// Standard object's metadata.
api.ObjectMeta
metav1.ObjectMeta
// Subjects holds references to the objects the role applies to.
Subjects []Subject

View File

@@ -19,7 +19,7 @@ package v1alpha1
import (
"fmt"
"k8s.io/kubernetes/pkg/api/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen=false

View File

@@ -19,7 +19,6 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api/v1"
)
// Authorization is calculated against
@@ -106,7 +105,7 @@ type Role struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// +optional
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Rules holds all the PolicyRules for this Role
Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"`
@@ -121,7 +120,7 @@ type RoleBinding struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// +optional
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Subjects holds references to the objects the role applies to.
Subjects []Subject `json:"subjects" protobuf:"bytes,2,rep,name=subjects"`
@@ -161,7 +160,7 @@ type ClusterRole struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// +optional
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Rules holds all the PolicyRules for this ClusterRole
Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"`
@@ -176,7 +175,7 @@ type ClusterRoleBinding struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// +optional
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Subjects holds references to the objects the role applies to.
Subjects []Subject `json:"subjects" protobuf:"bytes,2,rep,name=subjects"`

View File

@@ -19,6 +19,7 @@ package validation
import (
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/rbac"