-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow runtime.Object to be encoded as runtime.RawExtension #2786
Changes from all commits
84d84c5
dd24b01
714dbf4
1eaa5c4
db2c59f
8a833ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package v1beta3 | |
import ( | ||
"time" | ||
|
||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" | ||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" | ||
) | ||
|
||
|
@@ -556,9 +557,14 @@ type ReplicationControllerSpec struct { | |
// Selector is a label query over pods that should match the Replicas count. | ||
Selector map[string]string `json:"selector,omitempty"` | ||
|
||
// Template is a reference to an object that describes the pod that will be created if | ||
// TemplateRef is a reference to an object that describes the pod that will be created if | ||
// insufficient replicas are detected. | ||
Template ObjectReference `json:"template,omitempty"` | ||
TemplateRef *ObjectReference `json:"templateRef,omitempty"` | ||
|
||
// Template is the object that describes the pod that will be created if | ||
// insufficient replicas are detected. This takes precedence over a | ||
// TemplateRef. | ||
Template *PodTemplateSpec `json:"template,omitempty"` | ||
} | ||
|
||
// ReplicationControllerStatus represents the current status of a replication | ||
|
@@ -944,3 +950,11 @@ type EventList struct { | |
|
||
Items []Event `json:"items"` | ||
} | ||
|
||
// List holds a list of objects, which may not be known by the server. | ||
type List struct { | ||
TypeMeta `json:",inline"` | ||
ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []runtime.RawExtension `json:"items" description:"list of objects"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the description, clarify that the objects may be of any/multiple kinds. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Copyright 2014 Google Inc. All rights reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package conversion | ||
|
||
import ( | ||
"fmt" | ||
"reflect" | ||
) | ||
|
||
type notRegisteredErr struct { | ||
kind string | ||
version string | ||
t reflect.Type | ||
} | ||
|
||
func (k *notRegisteredErr) Error() string { | ||
if k.t != nil { | ||
return fmt.Sprintf("no kind is registered for the type %v", k.t) | ||
} | ||
if len(k.kind) == 0 { | ||
return fmt.Sprintf("no version %q has been registered", k.version) | ||
} | ||
if len(k.version) == 0 { | ||
return fmt.Sprintf("no kind %q is registered for the default version", k.kind) | ||
} | ||
return fmt.Sprintf("no kind %q is registered for version %q", k.kind, k.version) | ||
} | ||
|
||
// IsNotRegisteredError returns true if the error indicates the provided | ||
// object or input data is not registered. | ||
func IsNotRegisteredError(err error) bool { | ||
if err == nil { | ||
return false | ||
} | ||
_, ok := err.(*notRegisteredErr) | ||
return ok | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the value of Kind for a List containing objects of multiple Kinds? Is it always just
List
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - kind "List" means "generic container of things, including potentially other containers". "PodList" is a typed list.
----- Original Message -----