remove API to server library dependency

This commit is contained in:
deads2k 2017-01-10 13:10:39 -05:00
parent 958466f9eb
commit b26e9dce9f
2 changed files with 5 additions and 3 deletions

View File

@ -35,7 +35,6 @@ go_library(
"//pkg/types:go_default_library", "//pkg/types:go_default_library",
"//vendor:github.com/gogo/protobuf/proto", "//vendor:github.com/gogo/protobuf/proto",
"//vendor:github.com/ugorji/go/codec", "//vendor:github.com/ugorji/go/codec",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
], ],
) )

View File

@ -17,11 +17,14 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
"k8s.io/apiserver/pkg/authentication/user"
api "k8s.io/kubernetes/pkg/apis/rbac" api "k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/conversion"
) )
// allAuthenticated matches k8s.io/apiserver/pkg/authentication/user.AllAuthenticated,
// but we don't want an client library (which must include types), depending on a server library
const allAuthenticated = "system:authenticated"
func Convert_v1alpha1_Subject_To_rbac_Subject(in *Subject, out *api.Subject, s conversion.Scope) error { func Convert_v1alpha1_Subject_To_rbac_Subject(in *Subject, out *api.Subject, s conversion.Scope) error {
if err := autoConvert_v1alpha1_Subject_To_rbac_Subject(in, out, s); err != nil { if err := autoConvert_v1alpha1_Subject_To_rbac_Subject(in, out, s); err != nil {
return err return err
@ -32,7 +35,7 @@ func Convert_v1alpha1_Subject_To_rbac_Subject(in *Subject, out *api.Subject, s c
// Special treatment for * should not be included in v1beta1 // Special treatment for * should not be included in v1beta1
if out.Kind == UserKind && out.Name == "*" { if out.Kind == UserKind && out.Name == "*" {
out.Kind = GroupKind out.Kind = GroupKind
out.Name = user.AllAuthenticated out.Name = allAuthenticated
} }
return nil return nil