mirror of https://github.com/k3s-io/k3s
Merge pull request #59059 from smarterclayton/move_partial_object
Automatic merge from submit-queue (batch tested with PRs 59158, 38320, 59059, 55516, 59357). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Promote v1alpha1 meta to v1beta1 No code changes, just renames. We can discuss if there are any field / naming changes here or in a follow-up Parent #58536 Fixes #53224 Prereq to #55637 @kubernetes/sig-api-machinery-pr-reviews @deads2k ```release-note The `meta.k8s.io/v1alpha1` objects for retrieving tabular responses from the server (`Table`) or fetching just the `ObjectMeta` for an object (as `PartialObjectMetadata`) are now beta as part of `meta.k8s.io/v1beta1`. Clients may request alternate representations of normal Kubernetes objects by passing an `Accept` header like `application/json;as=Table;g=meta.k8s.io;v=v1beta1` or `application/json;as=PartialObjectMetadata;g=meta.k8s.io;v1=v1beta1`. Older servers will ignore this representation or return an error if it is not available. Clients may request fallback to the normal object by adding a non-qualified mime-type to their `Accept` header like `application/json` - the server will then respond with either the alternate representation if it is supported or the fallback mime-type which is the normal object response. ```pull/6/head
commit
9ee71b720e
|
@ -359,7 +359,7 @@ func startGarbageCollectorController(ctx ControllerContext) (bool, error) {
|
|||
// TODO: Make NewMetadataCodecFactory support arbitrary (non-compiled)
|
||||
// resource types. Otherwise we'll be storing full Unstructured data in our
|
||||
// caches for custom resources. Consider porting it to work with
|
||||
// metav1alpha1.PartialObjectMetadata.
|
||||
// metav1beta1.PartialObjectMetadata.
|
||||
metaOnlyClientPool := dynamic.NewClientPool(config, restMapper, dynamic.LegacyAPIPathResolverFunc)
|
||||
clientPool := dynamic.NewClientPool(config, restMapper, dynamic.LegacyAPIPathResolverFunc)
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ staging/src/k8s.io/apimachinery/pkg/apis/meta/fuzzer
|
|||
staging/src/k8s.io/apimachinery/pkg/apis/meta/internalversion
|
||||
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured
|
||||
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation
|
||||
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1alpha1
|
||||
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1beta1
|
||||
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup
|
||||
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1
|
||||
staging/src/k8s.io/apimachinery/pkg/conversion
|
||||
|
|
|
@ -277,11 +277,11 @@ kube::util::group-version-to-pkg-path() {
|
|||
meta/v1)
|
||||
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
;;
|
||||
meta/v1alpha1)
|
||||
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
|
||||
meta/v1beta1)
|
||||
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
;;
|
||||
meta/v1alpha1)
|
||||
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
|
||||
meta/v1beta1)
|
||||
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
;;
|
||||
unversioned)
|
||||
echo "pkg/api/unversioned"
|
||||
|
|
|
@ -29,7 +29,7 @@ source "${KUBE_ROOT}/hack/lib/swagger.sh"
|
|||
|
||||
kube::golang::setup_env
|
||||
|
||||
GROUP_VERSIONS=(meta/v1 meta/v1alpha1 ${KUBE_AVAILABLE_GROUP_VERSIONS})
|
||||
GROUP_VERSIONS=(meta/v1 meta/v1beta1 ${KUBE_AVAILABLE_GROUP_VERSIONS})
|
||||
|
||||
# To avoid compile errors, remove the currently existing files.
|
||||
for group_version in "${GROUP_VERSIONS[@]}"; do
|
||||
|
|
|
@ -54,7 +54,7 @@ openapi_library(
|
|||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1",
|
||||
"k8s.io/apimachinery/pkg/api/resource",
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"k8s.io/apimachinery/pkg/apis/testapigroup/v1",
|
||||
"k8s.io/apimachinery/pkg/runtime",
|
||||
"k8s.io/apimachinery/pkg/util/intstr",
|
||||
|
|
|
@ -26,7 +26,7 @@ go_library(
|
|||
"//vendor/github.com/ghodss/yaml:go_default_library",
|
||||
"//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/v1alpha1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
|
@ -75,7 +75,7 @@ go_test(
|
|||
deps = [
|
||||
"//pkg/apis/core: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",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
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/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
@ -34,19 +34,19 @@ import (
|
|||
)
|
||||
|
||||
type TablePrinter interface {
|
||||
PrintTable(obj runtime.Object, options PrintOptions) (*metav1alpha1.Table, error)
|
||||
PrintTable(obj runtime.Object, options PrintOptions) (*metav1beta1.Table, error)
|
||||
}
|
||||
|
||||
type PrintHandler interface {
|
||||
Handler(columns, columnsWithWide []string, printFunc interface{}) error
|
||||
TableHandler(columns []metav1alpha1.TableColumnDefinition, printFunc interface{}) error
|
||||
DefaultTableHandler(columns []metav1alpha1.TableColumnDefinition, printFunc interface{}) error
|
||||
TableHandler(columns []metav1beta1.TableColumnDefinition, printFunc interface{}) error
|
||||
DefaultTableHandler(columns []metav1beta1.TableColumnDefinition, printFunc interface{}) error
|
||||
}
|
||||
|
||||
var withNamespacePrefixColumns = []string{"NAMESPACE"} // TODO(erictune): print cluster name too.
|
||||
|
||||
type handlerEntry struct {
|
||||
columnDefinitions []metav1alpha1.TableColumnDefinition
|
||||
columnDefinitions []metav1beta1.TableColumnDefinition
|
||||
printRows bool
|
||||
printFunc reflect.Value
|
||||
args []reflect.Value
|
||||
|
@ -126,15 +126,15 @@ func (h *HumanReadablePrinter) EnsurePrintHeaders() {
|
|||
// Handler adds a print handler with a given set of columns to HumanReadablePrinter instance.
|
||||
// See ValidatePrintHandlerFunc for required method signature.
|
||||
func (h *HumanReadablePrinter) Handler(columns, columnsWithWide []string, printFunc interface{}) error {
|
||||
var columnDefinitions []metav1alpha1.TableColumnDefinition
|
||||
var columnDefinitions []metav1beta1.TableColumnDefinition
|
||||
for _, column := range columns {
|
||||
columnDefinitions = append(columnDefinitions, metav1alpha1.TableColumnDefinition{
|
||||
columnDefinitions = append(columnDefinitions, metav1beta1.TableColumnDefinition{
|
||||
Name: column,
|
||||
Type: "string",
|
||||
})
|
||||
}
|
||||
for _, column := range columnsWithWide {
|
||||
columnDefinitions = append(columnDefinitions, metav1alpha1.TableColumnDefinition{
|
||||
columnDefinitions = append(columnDefinitions, metav1beta1.TableColumnDefinition{
|
||||
Name: column,
|
||||
Type: "string",
|
||||
Priority: 1,
|
||||
|
@ -164,7 +164,7 @@ func (h *HumanReadablePrinter) Handler(columns, columnsWithWide []string, printF
|
|||
|
||||
// TableHandler adds a print handler with a given set of columns to HumanReadablePrinter instance.
|
||||
// See ValidateRowPrintHandlerFunc for required method signature.
|
||||
func (h *HumanReadablePrinter) TableHandler(columnDefinitions []metav1alpha1.TableColumnDefinition, printFunc interface{}) error {
|
||||
func (h *HumanReadablePrinter) TableHandler(columnDefinitions []metav1beta1.TableColumnDefinition, printFunc interface{}) error {
|
||||
printFuncValue := reflect.ValueOf(printFunc)
|
||||
if err := ValidateRowPrintHandlerFunc(printFuncValue); err != nil {
|
||||
utilruntime.HandleError(fmt.Errorf("unable to register print function: %v", err))
|
||||
|
@ -189,7 +189,7 @@ func (h *HumanReadablePrinter) TableHandler(columnDefinitions []metav1alpha1.Tab
|
|||
// DefaultTableHandler registers a set of columns and a print func that is given a chance to process
|
||||
// any object without an explicit handler. Only the most recently set print handler is used.
|
||||
// See ValidateRowPrintHandlerFunc for required method signature.
|
||||
func (h *HumanReadablePrinter) DefaultTableHandler(columnDefinitions []metav1alpha1.TableColumnDefinition, printFunc interface{}) error {
|
||||
func (h *HumanReadablePrinter) DefaultTableHandler(columnDefinitions []metav1beta1.TableColumnDefinition, printFunc interface{}) error {
|
||||
printFuncValue := reflect.ValueOf(printFunc)
|
||||
if err := ValidateRowPrintHandlerFunc(printFuncValue); err != nil {
|
||||
utilruntime.HandleError(fmt.Errorf("unable to register print function: %v", err))
|
||||
|
@ -208,7 +208,7 @@ func (h *HumanReadablePrinter) DefaultTableHandler(columnDefinitions []metav1alp
|
|||
// ValidateRowPrintHandlerFunc validates print handler signature.
|
||||
// printFunc is the function that will be called to print an object.
|
||||
// It must be of the following type:
|
||||
// func printFunc(object ObjectType, options PrintOptions) ([]metav1alpha1.TableRow, error)
|
||||
// func printFunc(object ObjectType, options PrintOptions) ([]metav1beta1.TableRow, error)
|
||||
// where ObjectType is the type of the object that will be printed, and the first
|
||||
// return value is an array of rows, with each row containing a number of cells that
|
||||
// match the number of columns defined for that printer function.
|
||||
|
@ -222,10 +222,10 @@ func ValidateRowPrintHandlerFunc(printFunc reflect.Value) error {
|
|||
"Must accept 2 parameters and return 2 value.")
|
||||
}
|
||||
if funcType.In(1) != reflect.TypeOf((*PrintOptions)(nil)).Elem() ||
|
||||
funcType.Out(0) != reflect.TypeOf((*[]metav1alpha1.TableRow)(nil)).Elem() ||
|
||||
funcType.Out(0) != reflect.TypeOf((*[]metav1beta1.TableRow)(nil)).Elem() ||
|
||||
funcType.Out(1) != reflect.TypeOf((*error)(nil)).Elem() {
|
||||
return fmt.Errorf("invalid print handler. The expected signature is: "+
|
||||
"func handler(obj %v, options PrintOptions) ([]metav1alpha1.TableRow, error)", funcType.In(0))
|
||||
"func handler(obj %v, options PrintOptions) ([]metav1beta1.TableRow, error)", funcType.In(0))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er
|
|||
}
|
||||
|
||||
// display tables following the rules of options
|
||||
if table, ok := obj.(*metav1alpha1.Table); ok {
|
||||
if table, ok := obj.(*metav1beta1.Table); ok {
|
||||
if err := DecorateTable(table, h.options); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -341,10 +341,10 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er
|
|||
return fmt.Errorf("error: unknown type %#v", obj)
|
||||
}
|
||||
|
||||
func hasCondition(conditions []metav1alpha1.TableRowCondition, t metav1alpha1.RowConditionType) bool {
|
||||
func hasCondition(conditions []metav1beta1.TableRowCondition, t metav1beta1.RowConditionType) bool {
|
||||
for _, condition := range conditions {
|
||||
if condition.Type == t {
|
||||
return condition.Status == metav1alpha1.ConditionTrue
|
||||
return condition.Status == metav1beta1.ConditionTrue
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
@ -353,7 +353,7 @@ func hasCondition(conditions []metav1alpha1.TableRowCondition, t metav1alpha1.Ro
|
|||
// PrintTable prints a table to the provided output respecting the filtering rules for options
|
||||
// for wide columns and filetred rows. It filters out rows that are Completed. You should call
|
||||
// DecorateTable if you receive a table from a remote server before calling PrintTable.
|
||||
func PrintTable(table *metav1alpha1.Table, output io.Writer, options PrintOptions) error {
|
||||
func PrintTable(table *metav1beta1.Table, output io.Writer, options PrintOptions) error {
|
||||
if !options.NoHeaders {
|
||||
first := true
|
||||
for _, column := range table.ColumnDefinitions {
|
||||
|
@ -370,7 +370,7 @@ func PrintTable(table *metav1alpha1.Table, output io.Writer, options PrintOption
|
|||
fmt.Fprintln(output)
|
||||
}
|
||||
for _, row := range table.Rows {
|
||||
if !options.ShowAll && hasCondition(row.Conditions, metav1alpha1.RowCompleted) {
|
||||
if !options.ShowAll && hasCondition(row.Conditions, metav1beta1.RowCompleted) {
|
||||
continue
|
||||
}
|
||||
first := true
|
||||
|
@ -397,7 +397,7 @@ func PrintTable(table *metav1alpha1.Table, output io.Writer, options PrintOption
|
|||
// namespace column. It will fill empty columns with nil (if the object
|
||||
// does not expose metadata). It returns an error if the table cannot
|
||||
// be decorated.
|
||||
func DecorateTable(table *metav1alpha1.Table, options PrintOptions) error {
|
||||
func DecorateTable(table *metav1beta1.Table, options PrintOptions) error {
|
||||
width := len(table.ColumnDefinitions) + len(options.ColumnLabels)
|
||||
if options.WithNamespace {
|
||||
width++
|
||||
|
@ -420,22 +420,22 @@ func DecorateTable(table *metav1alpha1.Table, options PrintOptions) error {
|
|||
}
|
||||
|
||||
if width != len(table.ColumnDefinitions) {
|
||||
columns = make([]metav1alpha1.TableColumnDefinition, 0, width)
|
||||
columns = make([]metav1beta1.TableColumnDefinition, 0, width)
|
||||
if options.WithNamespace {
|
||||
columns = append(columns, metav1alpha1.TableColumnDefinition{
|
||||
columns = append(columns, metav1beta1.TableColumnDefinition{
|
||||
Name: "Namespace",
|
||||
Type: "string",
|
||||
})
|
||||
}
|
||||
columns = append(columns, table.ColumnDefinitions...)
|
||||
for _, label := range formatLabelHeaders(options.ColumnLabels) {
|
||||
columns = append(columns, metav1alpha1.TableColumnDefinition{
|
||||
columns = append(columns, metav1beta1.TableColumnDefinition{
|
||||
Name: label,
|
||||
Type: "string",
|
||||
})
|
||||
}
|
||||
if options.ShowLabels {
|
||||
columns = append(columns, metav1alpha1.TableColumnDefinition{
|
||||
columns = append(columns, metav1beta1.TableColumnDefinition{
|
||||
Name: "Labels",
|
||||
Type: "string",
|
||||
})
|
||||
|
@ -492,7 +492,7 @@ func DecorateTable(table *metav1alpha1.Table, options PrintOptions) error {
|
|||
// PrintTable returns a table for the provided object, using the printer registered for that type. It returns
|
||||
// a table that includes all of the information requested by options, but will not remove rows or columns. The
|
||||
// caller is responsible for applying rules related to filtering rows or columns.
|
||||
func (h *HumanReadablePrinter) PrintTable(obj runtime.Object, options PrintOptions) (*metav1alpha1.Table, error) {
|
||||
func (h *HumanReadablePrinter) PrintTable(obj runtime.Object, options PrintOptions) (*metav1beta1.Table, error) {
|
||||
t := reflect.TypeOf(obj)
|
||||
handler, ok := h.handlerMap[t]
|
||||
if !ok {
|
||||
|
@ -510,7 +510,7 @@ func (h *HumanReadablePrinter) PrintTable(obj runtime.Object, options PrintOptio
|
|||
|
||||
columns := handler.columnDefinitions
|
||||
if !options.Wide {
|
||||
columns = make([]metav1alpha1.TableColumnDefinition, 0, len(handler.columnDefinitions))
|
||||
columns = make([]metav1beta1.TableColumnDefinition, 0, len(handler.columnDefinitions))
|
||||
for i := range handler.columnDefinitions {
|
||||
if handler.columnDefinitions[i].Priority != 0 {
|
||||
continue
|
||||
|
@ -518,12 +518,12 @@ func (h *HumanReadablePrinter) PrintTable(obj runtime.Object, options PrintOptio
|
|||
columns = append(columns, handler.columnDefinitions[i])
|
||||
}
|
||||
}
|
||||
table := &metav1alpha1.Table{
|
||||
table := &metav1beta1.Table{
|
||||
ListMeta: metav1.ListMeta{
|
||||
ResourceVersion: "",
|
||||
},
|
||||
ColumnDefinitions: columns,
|
||||
Rows: results[0].Interface().([]metav1alpha1.TableRow),
|
||||
Rows: results[0].Interface().([]metav1beta1.TableRow),
|
||||
}
|
||||
if m, err := meta.ListAccessor(obj); err == nil {
|
||||
table.ResourceVersion = m.GetResourceVersion()
|
||||
|
@ -582,7 +582,7 @@ func printRowsForHandlerEntry(output io.Writer, handler *handlerEntry, obj runti
|
|||
}
|
||||
|
||||
if results[1].IsNil() {
|
||||
rows := results[0].Interface().([]metav1alpha1.TableRow)
|
||||
rows := results[0].Interface().([]metav1beta1.TableRow)
|
||||
printRows(output, rows, options)
|
||||
return nil
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ func printRowsForHandlerEntry(output io.Writer, handler *handlerEntry, obj runti
|
|||
}
|
||||
|
||||
// printRows writes the provided rows to output.
|
||||
func printRows(output io.Writer, rows []metav1alpha1.TableRow, options PrintOptions) {
|
||||
func printRows(output io.Writer, rows []metav1beta1.TableRow, options PrintOptions) {
|
||||
for _, row := range rows {
|
||||
if options.WithNamespace {
|
||||
if obj := row.Object.Object; obj != nil {
|
||||
|
@ -630,9 +630,9 @@ func printRows(output io.Writer, rows []metav1alpha1.TableRow, options PrintOpti
|
|||
|
||||
// legacyPrinterToTable uses the old printFunc with tabbed writer to generate a table.
|
||||
// TODO: remove when all legacy printers are removed.
|
||||
func (h *HumanReadablePrinter) legacyPrinterToTable(obj runtime.Object, handler *handlerEntry) (*metav1alpha1.Table, error) {
|
||||
func (h *HumanReadablePrinter) legacyPrinterToTable(obj runtime.Object, handler *handlerEntry) (*metav1beta1.Table, error) {
|
||||
printFunc := handler.printFunc
|
||||
table := &metav1alpha1.Table{
|
||||
table := &metav1beta1.Table{
|
||||
ColumnDefinitions: handler.columnDefinitions,
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ func (h *HumanReadablePrinter) legacyPrinterToTable(obj runtime.Object, handler
|
|||
}
|
||||
for len(data) > 0 {
|
||||
cells, remainder := tabbedLineToCells(data, len(table.ColumnDefinitions))
|
||||
table.Rows = append(table.Rows, metav1alpha1.TableRow{
|
||||
table.Rows = append(table.Rows, metav1beta1.TableRow{
|
||||
Cells: cells,
|
||||
Object: runtime.RawExtension{Object: items[i]},
|
||||
})
|
||||
|
@ -674,7 +674,7 @@ func (h *HumanReadablePrinter) legacyPrinterToTable(obj runtime.Object, handler
|
|||
}
|
||||
data := buf.Bytes()
|
||||
cells, _ := tabbedLineToCells(data, len(table.ColumnDefinitions))
|
||||
table.Rows = append(table.Rows, metav1alpha1.TableRow{
|
||||
table.Rows = append(table.Rows, metav1beta1.TableRow{
|
||||
Cells: cells,
|
||||
Object: runtime.RawExtension{Object: obj},
|
||||
})
|
||||
|
|
|
@ -23,26 +23,26 @@ 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/runtime"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
)
|
||||
|
||||
var testNamespaceColumnDefinitions = []metav1alpha1.TableColumnDefinition{
|
||||
var testNamespaceColumnDefinitions = []metav1beta1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
|
||||
{Name: "Status", Type: "string", Description: "The status of the namespace"},
|
||||
{Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]},
|
||||
}
|
||||
|
||||
func testPrintNamespace(obj *api.Namespace, options PrintOptions) ([]metav1alpha1.TableRow, error) {
|
||||
func testPrintNamespace(obj *api.Namespace, options PrintOptions) ([]metav1beta1.TableRow, error) {
|
||||
if options.WithNamespace {
|
||||
return nil, fmt.Errorf("namespace is not namespaced")
|
||||
}
|
||||
row := metav1alpha1.TableRow{
|
||||
row := metav1beta1.TableRow{
|
||||
Object: runtime.RawExtension{Object: obj},
|
||||
}
|
||||
row.Cells = append(row.Cells, obj.Name, obj.Status.Phase, "<unknow>")
|
||||
return []metav1alpha1.TableRow{row}, nil
|
||||
return []metav1beta1.TableRow{row}, nil
|
||||
}
|
||||
|
||||
func TestPrintRowsForHandlerEntry(t *testing.T) {
|
||||
|
@ -58,7 +58,7 @@ func TestPrintRowsForHandlerEntry(t *testing.T) {
|
|||
}{
|
||||
"no tablecolumndefinition and includeheader flase": {
|
||||
h: &handlerEntry{
|
||||
columnDefinitions: []metav1alpha1.TableColumnDefinition{},
|
||||
columnDefinitions: []metav1beta1.TableColumnDefinition{},
|
||||
printRows: true,
|
||||
printFunc: printFunc,
|
||||
},
|
||||
|
@ -71,7 +71,7 @@ func TestPrintRowsForHandlerEntry(t *testing.T) {
|
|||
},
|
||||
"no tablecolumndefinition and includeheader true": {
|
||||
h: &handlerEntry{
|
||||
columnDefinitions: []metav1alpha1.TableColumnDefinition{},
|
||||
columnDefinitions: []metav1beta1.TableColumnDefinition{},
|
||||
printRows: true,
|
||||
printFunc: printFunc,
|
||||
},
|
||||
|
|
|
@ -37,7 +37,7 @@ go_test(
|
|||
"//vendor/k8s.io/apimachinery/pkg/api/resource: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/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer/yaml:go_default_library",
|
||||
|
@ -97,7 +97,7 @@ go_library(
|
|||
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/resource: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/fields:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -34,7 +34,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
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"
|
||||
yamlserializer "k8s.io/apimachinery/pkg/runtime/serializer/yaml"
|
||||
|
@ -1590,7 +1590,7 @@ func TestPrintPodTable(t *testing.T) {
|
|||
func TestPrintPod(t *testing.T) {
|
||||
tests := []struct {
|
||||
pod api.Pod
|
||||
expect []metav1alpha1.TableRow
|
||||
expect []metav1beta1.TableRow
|
||||
}{
|
||||
{
|
||||
// Test name, num of containers, restarts, container ready status
|
||||
|
@ -1605,7 +1605,7 @@ func TestPrintPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>"}}},
|
||||
},
|
||||
{
|
||||
// Test container error overwrites pod phase
|
||||
|
@ -1620,7 +1620,7 @@ func TestPrintPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test2", "1/2", "ContainerWaitingReason", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test2", "1/2", "ContainerWaitingReason", 6, "<unknown>"}}},
|
||||
},
|
||||
{
|
||||
// Test the same as the above but with Terminated state and the first container overwrites the rest
|
||||
|
@ -1635,7 +1635,7 @@ func TestPrintPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test3", "0/2", "ContainerWaitingReason", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test3", "0/2", "ContainerWaitingReason", 6, "<unknown>"}}},
|
||||
},
|
||||
{
|
||||
// Test ready is not enough for reporting running
|
||||
|
@ -1650,7 +1650,7 @@ func TestPrintPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test4", "1/2", "podPhase", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test4", "1/2", "podPhase", 6, "<unknown>"}}},
|
||||
},
|
||||
{
|
||||
// Test ready is not enough for reporting running
|
||||
|
@ -1666,7 +1666,7 @@ func TestPrintPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test5", "1/2", "podReason", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test5", "1/2", "podReason", 6, "<unknown>"}}},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1687,7 +1687,7 @@ func TestPrintPod(t *testing.T) {
|
|||
func TestPrintPodwide(t *testing.T) {
|
||||
tests := []struct {
|
||||
pod api.Pod
|
||||
expect []metav1alpha1.TableRow
|
||||
expect []metav1beta1.TableRow
|
||||
}{
|
||||
{
|
||||
// Test when the NodeName and PodIP are not none
|
||||
|
@ -1707,7 +1707,7 @@ func TestPrintPodwide(t *testing.T) {
|
|||
NominatedNodeName: "node1",
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>", "1.1.1.1", "test1", "node1"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>", "1.1.1.1", "test1", "node1"}}},
|
||||
},
|
||||
{
|
||||
// Test when the NodeName and PodIP are none
|
||||
|
@ -1726,7 +1726,7 @@ func TestPrintPodwide(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test2", "1/2", "ContainerWaitingReason", 6, "<unknown>", "<none>", "<none>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test2", "1/2", "ContainerWaitingReason", 6, "<unknown>", "<none>", "<none>"}}},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1747,7 +1747,7 @@ func TestPrintPodwide(t *testing.T) {
|
|||
func TestPrintPodList(t *testing.T) {
|
||||
tests := []struct {
|
||||
pods api.PodList
|
||||
expect []metav1alpha1.TableRow
|
||||
expect []metav1beta1.TableRow
|
||||
}{
|
||||
// Test podList's pod: name, num of containers, restarts, container ready status
|
||||
{
|
||||
|
@ -1776,7 +1776,7 @@ func TestPrintPodList(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test1", "2/2", "podPhase", 6, "<unknown>"}}, {Cells: []interface{}{"test2", "1/1", "podPhase", 1, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test1", "2/2", "podPhase", 6, "<unknown>"}}, {Cells: []interface{}{"test2", "1/1", "podPhase", 1, "<unknown>"}}},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1798,7 +1798,7 @@ func TestPrintPodList(t *testing.T) {
|
|||
func TestPrintNonTerminatedPod(t *testing.T) {
|
||||
tests := []struct {
|
||||
pod api.Pod
|
||||
expect []metav1alpha1.TableRow
|
||||
expect []metav1beta1.TableRow
|
||||
}{
|
||||
{
|
||||
// Test pod phase Running should be printed
|
||||
|
@ -1813,7 +1813,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test1", "1/2", "Running", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test1", "1/2", "Running", 6, "<unknown>"}}},
|
||||
},
|
||||
{
|
||||
// Test pod phase Pending should be printed
|
||||
|
@ -1828,7 +1828,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test2", "1/2", "Pending", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test2", "1/2", "Pending", 6, "<unknown>"}}},
|
||||
},
|
||||
{
|
||||
// Test pod phase Unknown should be printed
|
||||
|
@ -1843,7 +1843,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test3", "1/2", "Unknown", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test3", "1/2", "Unknown", 6, "<unknown>"}}},
|
||||
},
|
||||
{
|
||||
// Test pod phase Succeeded shouldn't be printed
|
||||
|
@ -1858,7 +1858,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test4", "1/2", "Succeeded", 6, "<unknown>"}, Conditions: podSuccessConditions}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test4", "1/2", "Succeeded", 6, "<unknown>"}, Conditions: podSuccessConditions}},
|
||||
},
|
||||
{
|
||||
// Test pod phase Failed shouldn't be printed
|
||||
|
@ -1873,7 +1873,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test5", "1/2", "Failed", 6, "<unknown>"}, Conditions: podFailedConditions}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test5", "1/2", "Failed", 6, "<unknown>"}, Conditions: podFailedConditions}},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1896,7 +1896,7 @@ func TestPrintPodWithLabels(t *testing.T) {
|
|||
tests := []struct {
|
||||
pod api.Pod
|
||||
labelColumns []string
|
||||
expect []metav1alpha1.TableRow
|
||||
expect []metav1beta1.TableRow
|
||||
}{
|
||||
{
|
||||
// Test name, num of containers, restarts, container ready status
|
||||
|
@ -1915,7 +1915,7 @@ func TestPrintPodWithLabels(t *testing.T) {
|
|||
},
|
||||
},
|
||||
[]string{"col1", "COL2"},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>", "asd", "zxc"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>", "asd", "zxc"}}},
|
||||
},
|
||||
{
|
||||
// Test name, num of containers, restarts, container ready status
|
||||
|
@ -1934,7 +1934,7 @@ func TestPrintPodWithLabels(t *testing.T) {
|
|||
},
|
||||
},
|
||||
[]string{},
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>"}}},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -2524,7 +2524,7 @@ func TestPrintPodShowLabels(t *testing.T) {
|
|||
tests := []struct {
|
||||
pod api.Pod
|
||||
showLabels bool
|
||||
expect []metav1alpha1.TableRow
|
||||
expect []metav1beta1.TableRow
|
||||
}{
|
||||
{
|
||||
// Test name, num of containers, restarts, container ready status
|
||||
|
@ -2543,7 +2543,7 @@ func TestPrintPodShowLabels(t *testing.T) {
|
|||
},
|
||||
},
|
||||
true,
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>", "COL2=zxc,col1=asd"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>", "COL2=zxc,col1=asd"}}},
|
||||
},
|
||||
{
|
||||
// Test name, num of containers, restarts, container ready status
|
||||
|
@ -2562,7 +2562,7 @@ func TestPrintPodShowLabels(t *testing.T) {
|
|||
},
|
||||
},
|
||||
false,
|
||||
[]metav1alpha1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>"}}},
|
||||
[]metav1beta1.TableRow{{Cells: []interface{}{"test1", "1/2", "podPhase", 6, "<unknown>"}}},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ go_library(
|
|||
importpath = "k8s.io/kubernetes/pkg/printers/storage",
|
||||
deps = [
|
||||
"//pkg/printers: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/apiserver/pkg/endpoints/request:go_default_library",
|
||||
],
|
||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
package storage
|
||||
|
||||
import (
|
||||
metav1alpha1 "k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
|
||||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/kubernetes/pkg/printers"
|
||||
|
@ -27,6 +27,6 @@ type TableConvertor struct {
|
|||
printers.TablePrinter
|
||||
}
|
||||
|
||||
func (c TableConvertor) ConvertToTable(ctx genericapirequest.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1alpha1.Table, error) {
|
||||
func (c TableConvertor) ConvertToTable(ctx genericapirequest.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
return c.TablePrinter.PrintTable(obj, printers.PrintOptions{Wide: true})
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ go_test(
|
|||
"//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/errors: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/fields:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
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/fields"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -409,7 +409,7 @@ func TestConvertToTableList(t *testing.T) {
|
|||
defer storage.Store.DestroyFunc()
|
||||
ctx := genericapirequest.NewDefaultContext()
|
||||
|
||||
columns := []metav1alpha1.TableColumnDefinition{
|
||||
columns := []metav1beta1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
|
||||
{Name: "Ready", Type: "string", Description: "The aggregate readiness state of this pod for accepting traffic."},
|
||||
{Name: "Status", Type: "string", Description: "The aggregate status of the containers in this pod."},
|
||||
|
@ -440,7 +440,7 @@ func TestConvertToTableList(t *testing.T) {
|
|||
|
||||
testCases := []struct {
|
||||
in runtime.Object
|
||||
out *metav1alpha1.Table
|
||||
out *metav1beta1.Table
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
|
@ -449,25 +449,25 @@ func TestConvertToTableList(t *testing.T) {
|
|||
},
|
||||
{
|
||||
in: &api.Pod{},
|
||||
out: &metav1alpha1.Table{
|
||||
out: &metav1beta1.Table{
|
||||
ColumnDefinitions: columns,
|
||||
Rows: []metav1alpha1.TableRow{
|
||||
Rows: []metav1beta1.TableRow{
|
||||
{Cells: []interface{}{"", "0/0", "", 0, "<unknown>", "<none>", "<none>"}, Object: runtime.RawExtension{Object: &api.Pod{}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
in: pod1,
|
||||
out: &metav1alpha1.Table{
|
||||
out: &metav1beta1.Table{
|
||||
ColumnDefinitions: columns,
|
||||
Rows: []metav1alpha1.TableRow{
|
||||
Rows: []metav1beta1.TableRow{
|
||||
{Cells: []interface{}{"foo", "1/2", "Pending", 10, "1y", "10.1.2.3", "test-node"}, Object: runtime.RawExtension{Object: pod1}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
in: &api.PodList{},
|
||||
out: &metav1alpha1.Table{ColumnDefinitions: columns},
|
||||
out: &metav1beta1.Table{ColumnDefinitions: columns},
|
||||
},
|
||||
}
|
||||
for i, test := range testCases {
|
||||
|
|
|
@ -58,7 +58,7 @@ filegroup(
|
|||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/fuzzer:all-srcs",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/internalversion:all-srcs",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:all-srcs",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1alpha1:all-srcs",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1beta1:all-srcs",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/testapigroup:all-srcs",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/conversion:all-srcs",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/fields:all-srcs",
|
||||
|
|
|
@ -679,7 +679,7 @@
|
|||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ go_test(
|
|||
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,7 +46,7 @@ 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",
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
@ -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 {
|
||||
|
|
|
@ -35,7 +35,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",
|
||||
|
|
|
@ -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{})
|
||||
|
|
|
@ -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"],
|
||||
)
|
|
@ -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])
|
||||
}
|
|
@ -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 {
|
|
@ -19,4 +19,4 @@ limitations under the License.
|
|||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
||||
// +groupName=meta.k8s.io
|
||||
package v1alpha1
|
||||
package v1beta1
|
|
@ -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, 0xd6, 0xa0, 0xf1, 0x9f, 0x8f, 0x2c, 0xbf, 0xc9, 0xf2, 0xba, 0xc8, 0xfa,
|
||||
0xc0, 0xf1, 0x9e, 0xe5, 0x57, 0xec, 0xe4, 0x65, 0xa6, 0x30, 0x6f, 0x62, 0x9e, 0x98, 0x4a, 0x64,
|
||||
0x26, 0x33, 0x62, 0x50, 0xc4, 0xcd, 0xb7, 0xa1, 0x1b, 0x9a, 0xa1, 0x1a, 0xd5, 0x93, 0x37, 0x9b,
|
||||
0xac, 0x75, 0x77, 0xa1, 0xc9, 0xda, 0x63, 0x6c, 0xa3, 0x51, 0x55, 0x70, 0x0f, 0x78, 0xfb, 0x10,
|
||||
0xe0, 0x92, 0x1c, 0x2a, 0x79, 0x8f, 0x7b, 0xbd, 0x8e, 0x6b, 0x50, 0x95, 0x42, 0x69, 0x74, 0x68,
|
||||
0xef, 0x42, 0xd3, 0x19, 0x7d, 0x7a, 0x26, 0x2d, 0x2a, 0x59, 0x9e, 0xc6, 0xdf, 0x21, 0xc1, 0x8f,
|
||||
0x80, 0x32, 0x95, 0x28, 0xfd, 0xaf, 0x74, 0xbb, 0x5a, 0xd6, 0xfb, 0xe4, 0x80, 0x1c, 0xee, 0x1e,
|
||||
0xbf, 0xe2, 0x9b, 0xfc, 0x5a, 0x7e, 0xed, 0x09, 0xfd, 0x79, 0x1b, 0x78, 0x5d, 0x1b, 0xd0, 0xeb,
|
||||
0x2c, 0xfa, 0x6f, 0x9d, 0xfe, 0xa0, 0xcf, 0x56, 0x7e, 0xfa, 0x83, 0x72, 0xe8, 0xc7, 0x74, 0x4b,
|
||||
0x21, 0x54, 0x6e, 0x9f, 0x1c, 0x3c, 0x3a, 0xdc, 0x3d, 0x7e, 0xcf, 0x37, 0x7f, 0x56, 0xbe, 0xd2,
|
||||
0x1a, 0xee, 0x74, 0x6d, 0xb0, 0x75, 0xd2, 0x3b, 0xa3, 0x51, 0x3d, 0x8d, 0xe9, 0xe3, 0xcf, 0x32,
|
||||
0x2e, 0xe1, 0xb4, 0x46, 0x65, 0xb4, 0xf3, 0x23, 0xba, 0xa7, 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, 0x4a, 0x99, 0xcc, 0x94, 0x06, 0x3b, 0x17, 0x55,
|
||||
0x9e, 0x75, 0x81, 0x13, 0x25, 0xa0, 0x14, 0x97, 0x27, 0x31, 0xa0, 0x3c, 0x11, 0x19, 0x68, 0xb0,
|
||||
0x12, 0x21, 0xe5, 0x95, 0x35, 0x68, 0xfc, 0x97, 0x03, 0xca, 0x6f, 0xa3, 0xbc, 0xca, 0xb3, 0x2e,
|
||||
0x70, 0xbc, 0x43, 0xf9, 0x88, 0x4e, 0x8e, 0x33, 0x85, 0xb3, 0x3a, 0xe6, 0x89, 0x29, 0x45, 0x66,
|
||||
0x32, 0x23, 0x7a, 0x43, 0x5c, 0x7f, 0xeb, 0xbb, 0xbe, 0xe9, 0xab, 0xc1, 0x3c, 0x79, 0xbb, 0xcd,
|
||||
0x52, 0xf7, 0xf7, 0x99, 0x6c, 0x3c, 0xc5, 0xd6, 0x1a, 0x55, 0x09, 0x2b, 0xc0, 0xbb, 0x87, 0x00,
|
||||
0x97, 0xcc, 0xa0, 0x94, 0x2b, 0xdc, 0x9b, 0x4d, 0x5c, 0x8d, 0xaa, 0x10, 0x4a, 0xa3, 0x43, 0x7b,
|
||||
0x1f, 0x9a, 0xce, 0xe9, 0xf3, 0x0b, 0x69, 0x51, 0xc9, 0xe2, 0x3c, 0xfe, 0x0e, 0x09, 0x7e, 0x02,
|
||||
0x94, 0xa9, 0x44, 0xe9, 0x7f, 0xa5, 0x4f, 0xca, 0xb1, 0x3e, 0x20, 0x87, 0xe4, 0x68, 0xef, 0xf4,
|
||||
0x35, 0xdf, 0xe6, 0xcf, 0xf2, 0x1b, 0x4f, 0xe8, 0x2f, 0x9a, 0xc0, 0x6b, 0x9b, 0x80, 0xde, 0x64,
|
||||
0xd1, 0x7f, 0xeb, 0xf4, 0x07, 0x7d, 0xb1, 0xf6, 0xd3, 0x1f, 0x95, 0x43, 0x5f, 0xd2, 0x1d, 0x85,
|
||||
0x50, 0xba, 0x03, 0x72, 0xf8, 0xe8, 0x68, 0xef, 0xf4, 0x03, 0xdf, 0xfa, 0x55, 0xf9, 0x5a, 0x69,
|
||||
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,
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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)
|
||||
}
|
|
@ -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"`
|
||||
}
|
||||
|
|
@ -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 {
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
|
||||
// This file was autogenerated by defaulter-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
@ -1031,7 +1031,7 @@
|
|||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ go_test(
|
|||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion: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/fields:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
|
|
|
@ -45,7 +45,7 @@ import (
|
|||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
metav1alpha1 "k8s.io/apimachinery/pkg/apis/meta/v1alpha1"
|
||||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -434,7 +434,7 @@ func (storage *SimpleRESTStorage) Export(ctx request.Context, name string, opts
|
|||
return obj, storage.errors["export"]
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) ConvertToTable(ctx request.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1alpha1.Table, error) {
|
||||
func (storage *SimpleRESTStorage) ConvertToTable(ctx request.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
return rest.NewDefaultTableConvertor(schema.GroupResource{Resource: "simple"}).ConvertToTable(ctx, obj, tableOptions)
|
||||
}
|
||||
|
||||
|
@ -1846,8 +1846,8 @@ func TestGetTable(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
partial := meta.AsPartialObjectMetadata(m)
|
||||
partial.GetObjectKind().SetGroupVersionKind(metav1alpha1.SchemeGroupVersion.WithKind("PartialObjectMetadata"))
|
||||
encodedBody, err := runtime.Encode(metainternalversion.Codecs.LegacyCodec(metav1alpha1.SchemeGroupVersion), partial)
|
||||
partial.GetObjectKind().SetGroupVersionKind(metav1beta1.SchemeGroupVersion.WithKind("PartialObjectMetadata"))
|
||||
encodedBody, err := runtime.Encode(metainternalversion.Codecs.LegacyCodec(metav1beta1.SchemeGroupVersion), partial)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -1860,7 +1860,7 @@ func TestGetTable(t *testing.T) {
|
|||
accept string
|
||||
params url.Values
|
||||
pretty bool
|
||||
expected *metav1alpha1.Table
|
||||
expected *metav1beta1.Table
|
||||
statusCode int
|
||||
item bool
|
||||
}{
|
||||
|
@ -1870,46 +1870,46 @@ func TestGetTable(t *testing.T) {
|
|||
},
|
||||
{
|
||||
item: true,
|
||||
accept: runtime.ContentTypeJSON + ";as=Table;v=v1alpha1;g=meta.k8s.io",
|
||||
expected: &metav1alpha1.Table{
|
||||
TypeMeta: metav1.TypeMeta{Kind: "Table", APIVersion: "meta.k8s.io/v1alpha1"},
|
||||
accept: runtime.ContentTypeJSON + ";as=Table;v=v1beta1;g=meta.k8s.io",
|
||||
expected: &metav1beta1.Table{
|
||||
TypeMeta: metav1.TypeMeta{Kind: "Table", APIVersion: "meta.k8s.io/v1beta1"},
|
||||
ListMeta: metav1.ListMeta{ResourceVersion: "10", SelfLink: "/blah"},
|
||||
ColumnDefinitions: []metav1alpha1.TableColumnDefinition{
|
||||
ColumnDefinitions: []metav1beta1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name", Description: metaDoc["name"]},
|
||||
{Name: "Created At", Type: "date", Description: metaDoc["creationTimestamp"]},
|
||||
},
|
||||
Rows: []metav1alpha1.TableRow{
|
||||
Rows: []metav1beta1.TableRow{
|
||||
{Cells: []interface{}{"foo1", now.Time.UTC().Format(time.RFC3339)}, Object: runtime.RawExtension{Raw: encodedBody}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
item: true,
|
||||
accept: runtime.ContentTypeJSON + ";as=Table;v=v1alpha1;g=meta.k8s.io",
|
||||
accept: runtime.ContentTypeJSON + ";as=Table;v=v1beta1;g=meta.k8s.io",
|
||||
params: url.Values{"includeObject": []string{"Metadata"}},
|
||||
expected: &metav1alpha1.Table{
|
||||
TypeMeta: metav1.TypeMeta{Kind: "Table", APIVersion: "meta.k8s.io/v1alpha1"},
|
||||
expected: &metav1beta1.Table{
|
||||
TypeMeta: metav1.TypeMeta{Kind: "Table", APIVersion: "meta.k8s.io/v1beta1"},
|
||||
ListMeta: metav1.ListMeta{ResourceVersion: "10", SelfLink: "/blah"},
|
||||
ColumnDefinitions: []metav1alpha1.TableColumnDefinition{
|
||||
ColumnDefinitions: []metav1beta1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name", Description: metaDoc["name"]},
|
||||
{Name: "Created At", Type: "date", Description: metaDoc["creationTimestamp"]},
|
||||
},
|
||||
Rows: []metav1alpha1.TableRow{
|
||||
Rows: []metav1beta1.TableRow{
|
||||
{Cells: []interface{}{"foo1", now.Time.UTC().Format(time.RFC3339)}, Object: runtime.RawExtension{Raw: encodedBody}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
accept: runtime.ContentTypeJSON + ";as=Table;v=v1alpha1;g=meta.k8s.io",
|
||||
accept: runtime.ContentTypeJSON + ";as=Table;v=v1beta1;g=meta.k8s.io",
|
||||
params: url.Values{"includeObject": []string{"Metadata"}},
|
||||
expected: &metav1alpha1.Table{
|
||||
TypeMeta: metav1.TypeMeta{Kind: "Table", APIVersion: "meta.k8s.io/v1alpha1"},
|
||||
expected: &metav1beta1.Table{
|
||||
TypeMeta: metav1.TypeMeta{Kind: "Table", APIVersion: "meta.k8s.io/v1beta1"},
|
||||
ListMeta: metav1.ListMeta{ResourceVersion: "10", SelfLink: "/test/link"},
|
||||
ColumnDefinitions: []metav1alpha1.TableColumnDefinition{
|
||||
ColumnDefinitions: []metav1beta1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name", Description: metaDoc["name"]},
|
||||
{Name: "Created At", Type: "date", Description: metaDoc["creationTimestamp"]},
|
||||
},
|
||||
Rows: []metav1alpha1.TableRow{
|
||||
Rows: []metav1beta1.TableRow{
|
||||
{Cells: []interface{}{"foo1", now.Time.UTC().Format(time.RFC3339)}, Object: runtime.RawExtension{Raw: encodedBody}},
|
||||
},
|
||||
},
|
||||
|
@ -1969,7 +1969,7 @@ func TestGetTable(t *testing.T) {
|
|||
if resp.StatusCode != http.StatusOK {
|
||||
t.Errorf("%d: unexpected response: %#v", i, resp)
|
||||
}
|
||||
var itemOut metav1alpha1.Table
|
||||
var itemOut metav1beta1.Table
|
||||
body, err := extractBody(resp, &itemOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -2031,12 +2031,12 @@ func TestGetPartialObjectMetadata(t *testing.T) {
|
|||
expectKind: schema.GroupVersionKind{Kind: "Simple", Group: testGroupVersion.Group, Version: testGroupVersion.Version},
|
||||
},
|
||||
{
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadata;v=v1alpha1;g=meta.k8s.io, application/json",
|
||||
expectKind: schema.GroupVersionKind{Kind: "PartialObjectMetadata", Group: "meta.k8s.io", Version: "v1alpha1"},
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadata;v=v1beta1;g=meta.k8s.io, application/json",
|
||||
expectKind: schema.GroupVersionKind{Kind: "PartialObjectMetadata", Group: "meta.k8s.io", Version: "v1beta1"},
|
||||
},
|
||||
{
|
||||
list: true,
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadata;v=v1alpha1;g=meta.k8s.io",
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadata;v=v1beta1;g=meta.k8s.io",
|
||||
statusCode: http.StatusNotAcceptable,
|
||||
},
|
||||
{
|
||||
|
@ -2046,36 +2046,36 @@ func TestGetPartialObjectMetadata(t *testing.T) {
|
|||
},
|
||||
{
|
||||
list: true,
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1alpha1;g=meta.k8s.io, application/json",
|
||||
expectKind: schema.GroupVersionKind{Kind: "PartialObjectMetadataList", Group: "meta.k8s.io", Version: "v1alpha1"},
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1beta1;g=meta.k8s.io, application/json",
|
||||
expectKind: schema.GroupVersionKind{Kind: "PartialObjectMetadataList", Group: "meta.k8s.io", Version: "v1beta1"},
|
||||
},
|
||||
{
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1alpha1;g=meta.k8s.io",
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1beta1;g=meta.k8s.io",
|
||||
statusCode: http.StatusNotAcceptable,
|
||||
},
|
||||
{
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadata;v=v1alpha1;g=meta.k8s.io",
|
||||
expected: &metav1alpha1.PartialObjectMetadata{
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadata;v=v1beta1;g=meta.k8s.io",
|
||||
expected: &metav1beta1.PartialObjectMetadata{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo1", Namespace: "ns1", CreationTimestamp: now, UID: types.UID("abcdef0123")},
|
||||
},
|
||||
expectKind: schema.GroupVersionKind{Kind: "PartialObjectMetadata", Group: "meta.k8s.io", Version: "v1alpha1"},
|
||||
expectKind: schema.GroupVersionKind{Kind: "PartialObjectMetadata", Group: "meta.k8s.io", Version: "v1beta1"},
|
||||
},
|
||||
{
|
||||
list: true,
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1alpha1;g=meta.k8s.io",
|
||||
expected: &metav1alpha1.PartialObjectMetadataList{
|
||||
Items: []*metav1alpha1.PartialObjectMetadata{
|
||||
accept: runtime.ContentTypeJSON + ";as=PartialObjectMetadataList;v=v1beta1;g=meta.k8s.io",
|
||||
expected: &metav1beta1.PartialObjectMetadataList{
|
||||
Items: []*metav1beta1.PartialObjectMetadata{
|
||||
{
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: "meta.k8s.io/v1alpha1", Kind: "PartialObjectMetadata"},
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: "meta.k8s.io/v1beta1", Kind: "PartialObjectMetadata"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo1", Namespace: "ns1", CreationTimestamp: now, UID: types.UID("newer")},
|
||||
},
|
||||
{
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: "meta.k8s.io/v1alpha1", Kind: "PartialObjectMetadata"},
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: "meta.k8s.io/v1beta1", Kind: "PartialObjectMetadata"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo2", Namespace: "ns2", CreationTimestamp: now, UID: types.UID("older")},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectKind: schema.GroupVersionKind{Kind: "PartialObjectMetadataList", Group: "meta.k8s.io", Version: "v1alpha1"},
|
||||
expectKind: schema.GroupVersionKind{Kind: "PartialObjectMetadataList", Group: "meta.k8s.io", Version: "v1beta1"},
|
||||
},
|
||||
}
|
||||
for i, test := range tests {
|
||||
|
@ -2116,7 +2116,7 @@ func TestGetPartialObjectMetadata(t *testing.T) {
|
|||
}
|
||||
body := ""
|
||||
if test.expected != nil {
|
||||
itemOut, d, err := extractBodyObject(resp, metainternalversion.Codecs.LegacyCodec(metav1alpha1.SchemeGroupVersion))
|
||||
itemOut, d, err := extractBodyObject(resp, metainternalversion.Codecs.LegacyCodec(metav1beta1.SchemeGroupVersion))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ go_library(
|
|||
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion: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/fields:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
|
|
|
@ -184,7 +184,7 @@ func TestNegotiate(t *testing.T) {
|
|||
{
|
||||
req: &http.Request{
|
||||
Header: http.Header{
|
||||
"Accept": []string{"application/json;as=BOGUS;v=v1alpha1;g=meta.k8s.io, application/json"},
|
||||
"Accept": []string{"application/json;as=BOGUS;v=v1beta1;g=meta.k8s.io, application/json"},
|
||||
},
|
||||
},
|
||||
contentType: "application/json",
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
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/apiserver/pkg/endpoints/handlers/negotiation"
|
||||
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
|
||||
|
@ -46,7 +46,7 @@ func transformResponseObject(ctx request.Context, scope RequestScope, req *http.
|
|||
if target := mediaType.Convert; target != nil {
|
||||
switch {
|
||||
|
||||
case target.Kind == "PartialObjectMetadata" && target.GroupVersion() == metav1alpha1.SchemeGroupVersion:
|
||||
case target.Kind == "PartialObjectMetadata" && target.GroupVersion() == metav1beta1.SchemeGroupVersion:
|
||||
if meta.IsListType(result) {
|
||||
// TODO: this should be calculated earlier
|
||||
err = newNotAcceptableError(fmt.Sprintf("you requested PartialObjectMetadata, but the requested object is a list (%T)", result))
|
||||
|
@ -59,7 +59,7 @@ func transformResponseObject(ctx request.Context, scope RequestScope, req *http.
|
|||
return
|
||||
}
|
||||
partial := meta.AsPartialObjectMetadata(m)
|
||||
partial.GetObjectKind().SetGroupVersionKind(metav1alpha1.SchemeGroupVersion.WithKind("PartialObjectMetadata"))
|
||||
partial.GetObjectKind().SetGroupVersionKind(metav1beta1.SchemeGroupVersion.WithKind("PartialObjectMetadata"))
|
||||
|
||||
// renegotiate under the internal version
|
||||
_, info, err := negotiation.NegotiateOutputMediaType(req, metainternalversion.Codecs, &scope)
|
||||
|
@ -67,25 +67,25 @@ func transformResponseObject(ctx request.Context, scope RequestScope, req *http.
|
|||
scope.err(err, w, req)
|
||||
return
|
||||
}
|
||||
encoder := metainternalversion.Codecs.EncoderForVersion(info.Serializer, metav1alpha1.SchemeGroupVersion)
|
||||
encoder := metainternalversion.Codecs.EncoderForVersion(info.Serializer, metav1beta1.SchemeGroupVersion)
|
||||
responsewriters.SerializeObject(info.MediaType, encoder, w, req, statusCode, partial)
|
||||
return
|
||||
|
||||
case target.Kind == "PartialObjectMetadataList" && target.GroupVersion() == metav1alpha1.SchemeGroupVersion:
|
||||
case target.Kind == "PartialObjectMetadataList" && target.GroupVersion() == metav1beta1.SchemeGroupVersion:
|
||||
if !meta.IsListType(result) {
|
||||
// TODO: this should be calculated earlier
|
||||
err = newNotAcceptableError(fmt.Sprintf("you requested PartialObjectMetadataList, but the requested object is not a list (%T)", result))
|
||||
scope.err(err, w, req)
|
||||
return
|
||||
}
|
||||
list := &metav1alpha1.PartialObjectMetadataList{}
|
||||
list := &metav1beta1.PartialObjectMetadataList{}
|
||||
err := meta.EachListItem(result, func(obj runtime.Object) error {
|
||||
m, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
partial := meta.AsPartialObjectMetadata(m)
|
||||
partial.GetObjectKind().SetGroupVersionKind(metav1alpha1.SchemeGroupVersion.WithKind("PartialObjectMetadata"))
|
||||
partial.GetObjectKind().SetGroupVersionKind(metav1beta1.SchemeGroupVersion.WithKind("PartialObjectMetadata"))
|
||||
list.Items = append(list.Items, partial)
|
||||
return nil
|
||||
})
|
||||
|
@ -100,16 +100,16 @@ func transformResponseObject(ctx request.Context, scope RequestScope, req *http.
|
|||
scope.err(err, w, req)
|
||||
return
|
||||
}
|
||||
encoder := metainternalversion.Codecs.EncoderForVersion(info.Serializer, metav1alpha1.SchemeGroupVersion)
|
||||
encoder := metainternalversion.Codecs.EncoderForVersion(info.Serializer, metav1beta1.SchemeGroupVersion)
|
||||
responsewriters.SerializeObject(info.MediaType, encoder, w, req, statusCode, list)
|
||||
return
|
||||
|
||||
case target.Kind == "Table" && target.GroupVersion() == metav1alpha1.SchemeGroupVersion:
|
||||
case target.Kind == "Table" && target.GroupVersion() == metav1beta1.SchemeGroupVersion:
|
||||
// TODO: relax the version abstraction
|
||||
// TODO: skip if this is a status response (delete without body)?
|
||||
|
||||
opts := &metav1alpha1.TableOptions{}
|
||||
if err := metav1alpha1.ParameterCodec.DecodeParameters(req.URL.Query(), metav1alpha1.SchemeGroupVersion, opts); err != nil {
|
||||
opts := &metav1beta1.TableOptions{}
|
||||
if err := metav1beta1.ParameterCodec.DecodeParameters(req.URL.Query(), metav1beta1.SchemeGroupVersion, opts); err != nil {
|
||||
scope.err(err, w, req)
|
||||
return
|
||||
}
|
||||
|
@ -123,14 +123,14 @@ func transformResponseObject(ctx request.Context, scope RequestScope, req *http.
|
|||
for i := range table.Rows {
|
||||
item := &table.Rows[i]
|
||||
switch opts.IncludeObject {
|
||||
case metav1alpha1.IncludeObject:
|
||||
case metav1beta1.IncludeObject:
|
||||
item.Object.Object, err = scope.Convertor.ConvertToVersion(item.Object.Object, scope.Kind.GroupVersion())
|
||||
if err != nil {
|
||||
scope.err(err, w, req)
|
||||
return
|
||||
}
|
||||
// TODO: rely on defaulting for the value here?
|
||||
case metav1alpha1.IncludeMetadata, "":
|
||||
case metav1beta1.IncludeMetadata, "":
|
||||
m, err := meta.Accessor(item.Object.Object)
|
||||
if err != nil {
|
||||
scope.err(err, w, req)
|
||||
|
@ -138,9 +138,9 @@ func transformResponseObject(ctx request.Context, scope RequestScope, req *http.
|
|||
}
|
||||
// TODO: turn this into an internal type and do conversion in order to get object kind automatically set?
|
||||
partial := meta.AsPartialObjectMetadata(m)
|
||||
partial.GetObjectKind().SetGroupVersionKind(metav1alpha1.SchemeGroupVersion.WithKind("PartialObjectMetadata"))
|
||||
partial.GetObjectKind().SetGroupVersionKind(metav1beta1.SchemeGroupVersion.WithKind("PartialObjectMetadata"))
|
||||
item.Object.Object = partial
|
||||
case metav1alpha1.IncludeNone:
|
||||
case metav1beta1.IncludeNone:
|
||||
item.Object.Object = nil
|
||||
default:
|
||||
// TODO: move this to validation on the table options?
|
||||
|
@ -155,7 +155,7 @@ func transformResponseObject(ctx request.Context, scope RequestScope, req *http.
|
|||
scope.err(err, w, req)
|
||||
return
|
||||
}
|
||||
encoder := metainternalversion.Codecs.EncoderForVersion(info.Serializer, metav1alpha1.SchemeGroupVersion)
|
||||
encoder := metainternalversion.Codecs.EncoderForVersion(info.Serializer, metav1beta1.SchemeGroupVersion)
|
||||
responsewriters.SerializeObject(info.MediaType, encoder, w, req, statusCode, table)
|
||||
return
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
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"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
|
@ -69,7 +69,7 @@ func (scope *RequestScope) err(err error, w http.ResponseWriter, req *http.Reque
|
|||
|
||||
func (scope *RequestScope) AllowsConversion(gvk schema.GroupVersionKind) bool {
|
||||
// TODO: this is temporary, replace with an abstraction calculated at endpoint installation time
|
||||
if gvk.GroupVersion() == metav1alpha1.SchemeGroupVersion {
|
||||
if gvk.GroupVersion() == metav1beta1.SchemeGroupVersion {
|
||||
switch gvk.Kind {
|
||||
case "Table":
|
||||
return scope.TableConvertor != nil
|
||||
|
|
|
@ -64,7 +64,7 @@ go_library(
|
|||
"//vendor/k8s.io/apimachinery/pkg/api/validation/path:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion: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/fields:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/api/validation/path"
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
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/fields"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -1368,7 +1368,7 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (e *Store) ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1alpha1.Table, error) {
|
||||
func (e *Store) ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
if e.TableConvertor != nil {
|
||||
return e.TableConvertor.ConvertToTable(ctx, object, tableOptions)
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ go_library(
|
|||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation: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/uuid:go_default_library",
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
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/watch"
|
||||
|
@ -134,7 +134,7 @@ type GetterWithOptions interface {
|
|||
}
|
||||
|
||||
type TableConvertor interface {
|
||||
ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1alpha1.Table, error)
|
||||
ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error)
|
||||
}
|
||||
|
||||
// Deleter is an object that can delete a named RESTful resource.
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
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"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
|
@ -40,14 +40,14 @@ func NewDefaultTableConvertor(resource schema.GroupResource) TableConvertor {
|
|||
|
||||
var swaggerMetadataDescriptions = metav1.ObjectMeta{}.SwaggerDoc()
|
||||
|
||||
func (c defaultTableConvertor) ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1alpha1.Table, error) {
|
||||
var table metav1alpha1.Table
|
||||
func (c defaultTableConvertor) ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
var table metav1beta1.Table
|
||||
fn := func(obj runtime.Object) error {
|
||||
m, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
return errNotAcceptable{resource: c.qualifiedResource}
|
||||
}
|
||||
table.Rows = append(table.Rows, metav1alpha1.TableRow{
|
||||
table.Rows = append(table.Rows, metav1beta1.TableRow{
|
||||
Cells: []interface{}{m.GetName(), m.GetCreationTimestamp().Time.UTC().Format(time.RFC3339)},
|
||||
Object: runtime.RawExtension{Object: obj},
|
||||
})
|
||||
|
@ -73,7 +73,7 @@ func (c defaultTableConvertor) ConvertToTable(ctx genericapirequest.Context, obj
|
|||
table.SelfLink = m.GetSelfLink()
|
||||
}
|
||||
}
|
||||
table.ColumnDefinitions = []metav1alpha1.TableColumnDefinition{
|
||||
table.ColumnDefinitions = []metav1beta1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name", Description: swaggerMetadataDescriptions["name"]},
|
||||
{Name: "Created At", Type: "date", Description: swaggerMetadataDescriptions["creationTimestamp"]},
|
||||
}
|
||||
|
|
|
@ -455,7 +455,7 @@
|
|||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ go_test(
|
|||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion: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",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -25,14 +25,14 @@ import (
|
|||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
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"
|
||||
)
|
||||
|
||||
func list(count int, rv string) *metainternalversion.List {
|
||||
var list metainternalversion.List
|
||||
for i := 0; i < count; i++ {
|
||||
list.Items = append(list.Items, &metav1alpha1.PartialObjectMetadata{
|
||||
list.Items = append(list.Items, &metav1beta1.PartialObjectMetadata{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("%d", i),
|
||||
},
|
||||
|
@ -80,7 +80,7 @@ func (p *testPager) PagedList(ctx context.Context, options metav1.ListOptions) (
|
|||
if p.remaining <= 0 {
|
||||
break
|
||||
}
|
||||
list.Items = append(list.Items, &metav1alpha1.PartialObjectMetadata{
|
||||
list.Items = append(list.Items, &metav1beta1.PartialObjectMetadata{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("%d", p.index),
|
||||
},
|
||||
|
|
|
@ -73,7 +73,7 @@ func New() *Generator {
|
|||
`+k8s.io/apimachinery/pkg/runtime/schema`,
|
||||
`+k8s.io/apimachinery/pkg/runtime`,
|
||||
`k8s.io/apimachinery/pkg/apis/meta/v1`,
|
||||
`k8s.io/apimachinery/pkg/apis/meta/v1alpha1`,
|
||||
`k8s.io/apimachinery/pkg/apis/meta/v1beta1`,
|
||||
}, ","),
|
||||
Packages: "",
|
||||
DropEmbeddedFields: "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta",
|
||||
|
|
|
@ -643,7 +643,7 @@
|
|||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -259,7 +259,7 @@
|
|||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -643,7 +643,7 @@
|
|||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -287,7 +287,7 @@
|
|||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ go_library(
|
|||
"//vendor/k8s.io/apimachinery/pkg/api/errors: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/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
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/client-go/util/workqueue"
|
||||
"k8s.io/kubernetes/pkg/printers"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
|
@ -47,8 +47,8 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() {
|
|||
_, err := c.CoreV1().Pods(ns).Create(newTablePod(podName))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
table := &metav1alpha1.Table{}
|
||||
err = c.CoreV1().RESTClient().Get().Resource("pods").Namespace(ns).Name(podName).SetHeader("Accept", "application/json;as=Table;v=v1alpha1;g=meta.k8s.io").Do().Into(table)
|
||||
table := &metav1beta1.Table{}
|
||||
err = c.CoreV1().RESTClient().Get().Resource("pods").Namespace(ns).Name(podName).SetHeader("Accept", "application/json;as=Table;v=v1beta1;g=meta.k8s.io").Do().Into(table)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
framework.Logf("Table: %#v", table)
|
||||
|
||||
|
@ -92,10 +92,10 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() {
|
|||
Fail("Unable to create template %d, exiting", i)
|
||||
})
|
||||
|
||||
pagedTable := &metav1alpha1.Table{}
|
||||
pagedTable := &metav1beta1.Table{}
|
||||
err := c.CoreV1().RESTClient().Get().Namespace(ns).Resource("podtemplates").
|
||||
VersionedParams(&metav1.ListOptions{Limit: 2}, metav1.ParameterCodec).
|
||||
SetHeader("Accept", "application/json;as=Table;v=v1alpha1;g=meta.k8s.io").
|
||||
SetHeader("Accept", "application/json;as=Table;v=v1beta1;g=meta.k8s.io").
|
||||
Do().Into(pagedTable)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
// TODO: kops PR job is still using etcd2, which prevents this feature from working. Remove this check when kops is upgraded to etcd3
|
||||
|
@ -111,7 +111,7 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() {
|
|||
|
||||
err = c.CoreV1().RESTClient().Get().Namespace(ns).Resource("podtemplates").
|
||||
VersionedParams(&metav1.ListOptions{Continue: pagedTable.Continue}, metav1.ParameterCodec).
|
||||
SetHeader("Accept", "application/json;as=Table;v=v1alpha1;g=meta.k8s.io").
|
||||
SetHeader("Accept", "application/json;as=Table;v=v1beta1;g=meta.k8s.io").
|
||||
Do().Into(pagedTable)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(len(pagedTable.Rows)).To(BeNumerically(">", 0))
|
||||
|
@ -121,8 +121,8 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() {
|
|||
It("should return generic metadata details across all namespaces for nodes", func() {
|
||||
c := f.ClientSet
|
||||
|
||||
table := &metav1alpha1.Table{}
|
||||
err := c.CoreV1().RESTClient().Get().Resource("nodes").SetHeader("Accept", "application/json;as=Table;v=v1alpha1;g=meta.k8s.io").Do().Into(table)
|
||||
table := &metav1beta1.Table{}
|
||||
err := c.CoreV1().RESTClient().Get().Resource("nodes").SetHeader("Accept", "application/json;as=Table;v=v1beta1;g=meta.k8s.io").Do().Into(table)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
framework.Logf("Table: %#v", table)
|
||||
|
||||
|
@ -141,14 +141,14 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() {
|
|||
It("should return a 406 for a backend which does not implement metadata", func() {
|
||||
c := f.ClientSet
|
||||
|
||||
table := &metav1alpha1.Table{}
|
||||
err := c.CoreV1().RESTClient().Get().Resource("services").SetHeader("Accept", "application/json;as=Table;v=v1alpha1;g=meta.k8s.io").Do().Into(table)
|
||||
table := &metav1beta1.Table{}
|
||||
err := c.CoreV1().RESTClient().Get().Resource("services").SetHeader("Accept", "application/json;as=Table;v=v1beta1;g=meta.k8s.io").Do().Into(table)
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.(errors.APIStatus).Status().Code).To(Equal(int32(406)))
|
||||
})
|
||||
})
|
||||
|
||||
func printTable(table *metav1alpha1.Table) string {
|
||||
func printTable(table *metav1beta1.Table) string {
|
||||
buf := &bytes.Buffer{}
|
||||
tw := tabwriter.NewWriter(buf, 5, 8, 1, ' ', 0)
|
||||
err := printers.PrintTable(table, tw, printers.PrintOptions{})
|
||||
|
|
Loading…
Reference in New Issue