diff --git a/pkg/admission/config.go b/pkg/admission/config.go index 07c2c90f8..f59d0608b 100644 --- a/pkg/admission/config.go +++ b/pkg/admission/config.go @@ -29,7 +29,6 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/apis/apiserver" @@ -177,26 +176,3 @@ func (p configProvider) ConfigFor(pluginName string) (io.Reader, error) { // there is no registered config that matches on plugin name. return nil, nil } - -// writeYAML writes the specified object to a byte array as yaml. -func writeYAML(obj runtime.Object, scheme *runtime.Scheme) ([]byte, error) { - gvks, _, err := scheme.ObjectKinds(obj) - if err != nil { - return nil, err - } - gvs := []schema.GroupVersion{} - for _, gvk := range gvks { - gvs = append(gvs, gvk.GroupVersion()) - } - codecs := serializer.NewCodecFactory(scheme) - json, err := runtime.Encode(codecs.LegacyCodec(gvs...), obj) - if err != nil { - return nil, err - } - - content, err := yaml.JSONToYAML(json) - if err != nil { - return nil, err - } - return content, err -} diff --git a/pkg/endpoints/handlers/negotiation/negotiate.go b/pkg/endpoints/handlers/negotiation/negotiate.go index 226c0efe9..f9bb47bab 100644 --- a/pkg/endpoints/handlers/negotiation/negotiate.go +++ b/pkg/endpoints/handlers/negotiation/negotiate.go @@ -119,32 +119,6 @@ func isPrettyPrint(req *http.Request) bool { return false } -// negotiate the most appropriate content type given the accept header and a list of -// alternatives. -func negotiate(header string, alternatives []string) (goautoneg.Accept, bool) { - alternates := make([][]string, 0, len(alternatives)) - for _, alternate := range alternatives { - alternates = append(alternates, strings.SplitN(alternate, "/", 2)) - } - for _, clause := range goautoneg.ParseAccept(header) { - for _, alternate := range alternates { - if clause.Type == alternate[0] && clause.SubType == alternate[1] { - return clause, true - } - if clause.Type == alternate[0] && clause.SubType == "*" { - clause.SubType = alternate[1] - return clause, true - } - if clause.Type == "*" && clause.SubType == "*" { - clause.Type = alternate[0] - clause.SubType = alternate[1] - return clause, true - } - } - } - return goautoneg.Accept{}, false -} - // EndpointRestrictions is an interface that allows content-type negotiation // to verify server support for specific options type EndpointRestrictions interface {