Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
9ac39849
Commit
9ac39849
authored
Jul 06, 2017
by
shiywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test resource carp and change name
parent
da4a875e
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
364 additions
and
172 deletions
+364
-172
doc.go
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/doc.go
+3
-3
fuzzer.go
...8s.io/apimachinery/pkg/apis/testapigroup/fuzzer/fuzzer.go
+13
-13
install.go
....io/apimachinery/pkg/apis/testapigroup/install/install.go
+7
-7
register.go
...src/k8s.io/apimachinery/pkg/apis/testapigroup/register.go
+1
-1
types.go
...ng/src/k8s.io/apimachinery/pkg/apis/testapigroup/types.go
+21
-21
BUILD
...ng/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/BUILD
+1
-0
doc.go
...g/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/doc.go
+3
-3
generated.pb.go
....io/apimachinery/pkg/apis/testapigroup/v1/generated.pb.go
+8
-8
generated.proto
....io/apimachinery/pkg/apis/testapigroup/v1/generated.proto
+35
-35
register.go
.../k8s.io/apimachinery/pkg/apis/testapigroup/v1/register.go
+1
-1
types.generated.go
.../apimachinery/pkg/apis/testapigroup/v1/types.generated.go
+2
-2
types.go
...src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/types.go
+34
-34
zz_generated.conversion.go
...inery/pkg/apis/testapigroup/v1/zz_generated.conversion.go
+192
-1
api_meta_help_test.go
...ng/src/k8s.io/apimachinery/pkg/test/api_meta_help_test.go
+24
-24
api_meta_meta_test.go
...ng/src/k8s.io/apimachinery/pkg/test/api_meta_meta_test.go
+3
-3
apis_meta_v1_unstructed_unstructure_test.go
...nery/pkg/test/apis_meta_v1_unstructed_unstructure_test.go
+4
-4
runtime_helper_test.go
...g/src/k8s.io/apimachinery/pkg/test/runtime_helper_test.go
+4
-4
util.go
staging/src/k8s.io/apimachinery/pkg/test/util.go
+8
-8
No files found.
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/doc.go
View file @
9ac39849
...
...
@@ -15,8 +15,8 @@ limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +groupName=
example
.k8s.io
// +groupName=
testapigroup.apimachinery
.k8s.io
//
// package
example contains an example
API used to demonstrate how to create api groups. Moreover, this is
// package
testapigroup contains an testapigroup
API used to demonstrate how to create api groups. Moreover, this is
// used within tests.
package
testapigroup
// import "k8s.io/api
server/pkg/apis/example
"
package
testapigroup
// import "k8s.io/api
machinery/pkg/apis/testapigroup
"
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/fuzzer/fuzzer.go
View file @
9ac39849
...
...
@@ -20,13 +20,13 @@ import (
"github.com/google/gofuzz"
apitesting
"k8s.io/apimachinery/pkg/api/testing"
example
"k8s.io/apimachinery/pkg/apis/testapigroup"
examplev1
"k8s.io/apimachinery/pkg/apis/testapigroup/v1"
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/apis/testapigroup/v1"
"k8s.io/apimachinery/pkg/runtime"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
)
// overrideGenericFuncs override some generic fuzzer funcs from k8s.io/api
server
in order to have more realistic
// overrideGenericFuncs override some generic fuzzer funcs from k8s.io/api
machinery
in order to have more realistic
// values in a Kubernetes context.
func
overrideGenericFuncs
(
t
apitesting
.
TestingCommon
,
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
return
[]
interface
{}{
...
...
@@ -39,7 +39,7 @@ func overrideGenericFuncs(t apitesting.TestingCommon, codecs runtimeserializer.C
ContentType
:
runtime
.
ContentTypeJSON
,
}
}
else
{
types
:=
[]
runtime
.
Object
{
&
example
.
Carp
{}}
types
:=
[]
runtime
.
Object
{
&
testapigroup
.
Carp
{}}
t
:=
types
[
c
.
Rand
.
Intn
(
len
(
types
))]
c
.
Fuzz
(
t
)
*
j
=
t
...
...
@@ -47,12 +47,12 @@ func overrideGenericFuncs(t apitesting.TestingCommon, codecs runtimeserializer.C
},
func
(
r
*
runtime
.
RawExtension
,
c
fuzz
.
Continue
)
{
// Pick an arbitrary type and fuzz it
types
:=
[]
runtime
.
Object
{
&
example
.
Carp
{}}
types
:=
[]
runtime
.
Object
{
&
testapigroup
.
Carp
{}}
obj
:=
types
[
c
.
Rand
.
Intn
(
len
(
types
))]
c
.
Fuzz
(
obj
)
// Convert the object to raw bytes
bytes
,
err
:=
runtime
.
Encode
(
apitesting
.
TestCodec
(
codecs
,
example
v1
.
SchemeGroupVersion
),
obj
)
bytes
,
err
:=
runtime
.
Encode
(
apitesting
.
TestCodec
(
codecs
,
v1
.
SchemeGroupVersion
),
obj
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to encode object: %v"
,
err
)
return
...
...
@@ -64,9 +64,9 @@ func overrideGenericFuncs(t apitesting.TestingCommon, codecs runtimeserializer.C
}
}
func
example
Funcs
(
t
apitesting
.
TestingCommon
)
[]
interface
{}
{
func
testapigroup
Funcs
(
t
apitesting
.
TestingCommon
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
s
*
example
.
CarpSpec
,
c
fuzz
.
Continue
)
{
func
(
s
*
testapigroup
.
CarpSpec
,
c
fuzz
.
Continue
)
{
c
.
FuzzNoCustom
(
s
)
// has a default value
ttl
:=
int64
(
30
)
...
...
@@ -79,12 +79,12 @@ func exampleFuncs(t apitesting.TestingCommon) []interface{} {
s
.
SchedulerName
=
"default-scheduler"
}
},
func
(
j
*
example
.
CarpPhase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
example
.
CarpPhase
{
"Pending"
,
"Running"
,
"Succeeded"
,
"Failed"
,
"Unknown"
}
func
(
j
*
testapigroup
.
CarpPhase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
testapigroup
.
CarpPhase
{
"Pending"
,
"Running"
,
"Succeeded"
,
"Failed"
,
"Unknown"
}
*
j
=
statuses
[
c
.
Rand
.
Intn
(
len
(
statuses
))]
},
func
(
rp
*
example
.
RestartPolicy
,
c
fuzz
.
Continue
)
{
policies
:=
[]
example
.
RestartPolicy
{
"Always"
,
"Never"
,
"OnFailure"
}
func
(
rp
*
testapigroup
.
RestartPolicy
,
c
fuzz
.
Continue
)
{
policies
:=
[]
testapigroup
.
RestartPolicy
{
"Always"
,
"Never"
,
"OnFailure"
}
*
rp
=
policies
[
c
.
Rand
.
Intn
(
len
(
policies
))]
},
}
...
...
@@ -94,6 +94,6 @@ func Funcs(t apitesting.TestingCommon, codecs runtimeserializer.CodecFactory) []
return
apitesting
.
MergeFuzzerFuncs
(
t
,
apitesting
.
GenericFuzzerFuncs
(
t
,
codecs
),
overrideGenericFuncs
(
t
,
codecs
),
example
Funcs
(
t
),
testapigroup
Funcs
(
t
),
)
}
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/install/install.go
View file @
9ac39849
...
...
@@ -21,8 +21,8 @@ package install
import
(
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
example
"k8s.io/apimachinery/pkg/apis/testapigroup"
examplev1
"k8s.io/apimachinery/pkg/apis/testapigroup/v1"
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/apis/testapigroup/v1"
"k8s.io/apimachinery/pkg/runtime"
)
...
...
@@ -30,13 +30,13 @@ import (
func
Install
(
groupFactoryRegistry
announced
.
APIGroupFactoryRegistry
,
registry
*
registered
.
APIRegistrationManager
,
scheme
*
runtime
.
Scheme
)
{
if
err
:=
announced
.
NewGroupMetaFactory
(
&
announced
.
GroupMetaFactoryArgs
{
GroupName
:
example
.
GroupName
,
VersionPreferenceOrder
:
[]
string
{
example
v1
.
SchemeGroupVersion
.
Version
},
ImportPrefix
:
"k8s.io/api
server/pkg/apis/example
"
,
AddInternalObjectsToScheme
:
example
.
AddToScheme
,
GroupName
:
testapigroup
.
GroupName
,
VersionPreferenceOrder
:
[]
string
{
v1
.
SchemeGroupVersion
.
Version
},
ImportPrefix
:
"k8s.io/api
machinery/pkg/apis/testapigroup
"
,
AddInternalObjectsToScheme
:
testapigroup
.
AddToScheme
,
},
announced
.
VersionToSchemeFunc
{
examplev1
.
SchemeGroupVersion
.
Version
:
example
v1
.
AddToScheme
,
v1
.
SchemeGroupVersion
.
Version
:
v1
.
AddToScheme
,
},
)
.
Announce
(
groupFactoryRegistry
)
.
RegisterAndEnable
(
registry
,
scheme
);
err
!=
nil
{
panic
(
err
)
...
...
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/register.go
View file @
9ac39849
...
...
@@ -27,7 +27,7 @@ var (
)
// GroupName is the group name use in this package
const
GroupName
=
"
example.apiserver
.k8s.io"
const
GroupName
=
"
testapigroup.apimachinery
.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
runtime
.
APIVersionInternal
}
...
...
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/types.go
View file @
9ac39849
...
...
@@ -33,27 +33,27 @@ type Carp struct {
// +optional
metav1
.
ObjectMeta
// Spec defines the behavior of a
pod
.
// Spec defines the behavior of a
carp
.
// +optional
Spec
CarpSpec
// Status represents the current information about a
pod
. This data may not be up
// Status represents the current information about a
carp
. This data may not be up
// to date.
// +optional
Status
CarpStatus
}
// CarpStatus represents information about the status of a
pod
. Status may trail the actual
// CarpStatus represents information about the status of a
carp
. Status may trail the actual
// state of a system.
type
CarpStatus
struct
{
// +optional
Phase
CarpPhase
// +optional
Conditions
[]
CarpCondition
// A human readable message indicating details about why the
pod
is in this state.
// A human readable message indicating details about why the
carp
is in this state.
// +optional
Message
string
// A brief CamelCase message indicating details about why the
pod
is in this state. e.g. 'OutOfDisk'
// A brief CamelCase message indicating details about why the
carp
is in this state. e.g. 'OutOfDisk'
// +optional
Reason
string
...
...
@@ -63,7 +63,7 @@ type CarpStatus struct {
CarpIP
string
// Date and time at which the object was acknowledged by the Kubelet.
// This is before the Kubelet pulled the container image(s) for the
pod
.
// This is before the Kubelet pulled the container image(s) for the
carp
.
// +optional
StartTime
*
metav1
.
Time
}
...
...
@@ -81,45 +81,45 @@ type CarpCondition struct {
Message
string
}
// CarpSpec is a description of a
pod
// CarpSpec is a description of a
carp
type
CarpSpec
struct
{
// +optional
RestartPolicy
RestartPolicy
// Optional duration in seconds the
pod
needs to terminate gracefully. May be decreased in delete request.
// Optional duration in seconds the
carp
needs to terminate gracefully. May be decreased in delete request.
// Value must be non-negative integer. The value zero indicates delete immediately.
// If this value is nil, the default grace period will be used instead.
// The grace period is the duration in seconds after the processes running in the
pod
are sent
// The grace period is the duration in seconds after the processes running in the
carp
are sent
// a termination signal and the time when the processes are forcibly halted with a kill signal.
// Set this value longer than the expected cleanup time for your process.
// +optional
TerminationGracePeriodSeconds
*
int64
// Optional duration in seconds relative to the StartTime that the
pod
may be active on a node
// before the system actively tries to terminate the
pod
; value must be positive integer
// Optional duration in seconds relative to the StartTime that the
carp
may be active on a node
// before the system actively tries to terminate the
carp
; value must be positive integer
// +optional
ActiveDeadlineSeconds
*
int64
// NodeSelector is a selector which must be true for the
pod
to fit on a node
// NodeSelector is a selector which must be true for the
carp
to fit on a node
// +optional
NodeSelector
map
[
string
]
string
// ServiceAccountName is the name of the ServiceAccount to use to run this
pod
// The
pod
will be allowed to use secrets referenced by the ServiceAccount
// ServiceAccountName is the name of the ServiceAccount to use to run this
carp
// The
carp
will be allowed to use secrets referenced by the ServiceAccount
ServiceAccountName
string
// NodeName is a request to schedule this
pod
onto a specific node. If it is non-empty,
// the scheduler simply schedules this
pod
onto that node, assuming that it fits resource
// NodeName is a request to schedule this
carp
onto a specific node. If it is non-empty,
// the scheduler simply schedules this
carp
onto that node, assuming that it fits resource
// requirements.
// +optional
NodeName
string
// Specifies the hostname of the Carp.
// If not specified, the
pod
's hostname will be set to a system-defined value.
// If not specified, the
carp
's hostname will be set to a system-defined value.
// +optional
Hostname
string
// If specified, the fully qualified Carp hostname will be "<hostname>.<subdomain>.<
pod
namespace>.svc.<cluster domain>".
// If not specified, the
pod
will not have a domainname at all.
// If specified, the fully qualified Carp hostname will be "<hostname>.<subdomain>.<
carp
namespace>.svc.<cluster domain>".
// If not specified, the
carp
will not have a domainname at all.
// +optional
Subdomain
string
// If specified, the
pod
will be dispatched by specified scheduler.
// If not specified, the
pod
will be dispatched by default scheduler.
// If specified, the
carp
will be dispatched by specified scheduler.
// If not specified, the
carp
will be dispatched by default scheduler.
// +optional
SchedulerName
string
}
...
...
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/BUILD
View file @
9ac39849
...
...
@@ -28,6 +28,7 @@ go_library(
"//vendor/github.com/gogo/protobuf/sortkeys:go_default_library",
"//vendor/github.com/ugorji/go/codec:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/testapigroup: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",
...
...
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/doc.go
View file @
9ac39849
...
...
@@ -15,9 +15,9 @@ limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=k8s.io/kubernetes/vendor/k8s.io/api
server/pkg/apis/example
// +k8s:conversion-gen=k8s.io/kubernetes/vendor/k8s.io/api
machinery/pkg/apis/testapigroup
// +k8s:openapi-gen=false
// +k8s:defaulter-gen=TypeMeta
// +groupName=
example.apiserver
.k8s.io
package
v1
// import "k8s.io/api
server/pkg/apis/example
/v1"
// +groupName=
testapigroup.apimachinery
.k8s.io
package
v1
// import "k8s.io/api
machinery/pkg/apis/testapigroup
/v1"
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/generated.pb.go
View file @
9ac39849
...
...
@@ -15,14 +15,14 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo.
// source: k8s.io/kubernetes/vendor/k8s.io/api
server/pkg/apis/example
/v1/generated.proto
// source: k8s.io/kubernetes/vendor/k8s.io/api
machinery/pkg/apis/testapigroup
/v1/generated.proto
// DO NOT EDIT!
/*
Package v1 is a generated protocol buffer package.
It is generated from these files:
k8s.io/kubernetes/vendor/k8s.io/api
server/pkg/apis/example
/v1/generated.proto
k8s.io/kubernetes/vendor/k8s.io/api
machinery/pkg/apis/testapigroup
/v1/generated.proto
It has these top-level messages:
Carp
...
...
@@ -78,11 +78,11 @@ func (*CarpStatus) ProtoMessage() {}
func
(
*
CarpStatus
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptorGenerated
,
[]
int
{
4
}
}
func
init
()
{
proto
.
RegisterType
((
*
Carp
)(
nil
),
"k8s.io.api
server.pkg.apis.example
.v1.Carp"
)
proto
.
RegisterType
((
*
CarpCondition
)(
nil
),
"k8s.io.api
server.pkg.apis.example
.v1.CarpCondition"
)
proto
.
RegisterType
((
*
CarpList
)(
nil
),
"k8s.io.api
server.pkg.apis.example
.v1.CarpList"
)
proto
.
RegisterType
((
*
CarpSpec
)(
nil
),
"k8s.io.api
server.pkg.apis.example
.v1.CarpSpec"
)
proto
.
RegisterType
((
*
CarpStatus
)(
nil
),
"k8s.io.api
server.pkg.apis.example
.v1.CarpStatus"
)
proto
.
RegisterType
((
*
Carp
)(
nil
),
"k8s.io.api
machinery.pkg.apis.testapigroup
.v1.Carp"
)
proto
.
RegisterType
((
*
CarpCondition
)(
nil
),
"k8s.io.api
machinery.pkg.apis.testapigroup
.v1.CarpCondition"
)
proto
.
RegisterType
((
*
CarpList
)(
nil
),
"k8s.io.api
machinery.pkg.apis.testapigroup
.v1.CarpList"
)
proto
.
RegisterType
((
*
CarpSpec
)(
nil
),
"k8s.io.api
machinery.pkg.apis.testapigroup
.v1.CarpSpec"
)
proto
.
RegisterType
((
*
CarpStatus
)(
nil
),
"k8s.io.api
machinery.pkg.apis.testapigroup
.v1.CarpStatus"
)
}
func
(
m
*
Carp
)
Marshal
()
(
dAtA
[]
byte
,
err
error
)
{
size
:=
m
.
Size
()
...
...
@@ -1934,7 +1934,7 @@ var (
)
func
init
()
{
proto
.
RegisterFile
(
"k8s.io/kubernetes/vendor/k8s.io/api
server/pkg/apis/example
/v1/generated.proto"
,
fileDescriptorGenerated
)
proto
.
RegisterFile
(
"k8s.io/kubernetes/vendor/k8s.io/api
machinery/pkg/apis/testapigroup
/v1/generated.proto"
,
fileDescriptorGenerated
)
}
var
fileDescriptorGenerated
=
[]
byte
{
...
...
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/generated.proto
View file @
9ac39849
...
...
@@ -19,7 +19,7 @@ limitations under the License.
syntax
=
'proto2'
;
package
k8s
.
io.api
server.pkg.apis.example
.v1
;
package
k8s
.
io.api
machinery.pkg.apis.testapigroup
.v1
;
import
"k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"
;
import
"k8s.io/apimachinery/pkg/runtime/generated.proto"
;
...
...
@@ -36,12 +36,12 @@ message Carp {
// +optional
optional
k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta
metadata
=
1
;
// Specification of the desired behavior of the
pod
.
// Specification of the desired behavior of the
carp
.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
// +optional
optional
CarpSpec
spec
=
2
;
// Most recently observed status of the
pod
.
// Most recently observed status of the
carp
.
// This data may not be up to date.
// Populated by the system.
// Read-only.
...
...
@@ -53,12 +53,12 @@ message Carp {
message
CarpCondition
{
// Type is the type of the condition.
// Currently only Ready.
// More info: http://kubernetes.io/docs/user-guide/
pod-states#pod
-conditions
// More info: http://kubernetes.io/docs/user-guide/
carp-states#carp
-conditions
optional
string
type
=
1
;
// Status is the status of the condition.
// Can be True, False, Unknown.
// More info: http://kubernetes.io/docs/user-guide/
pod-states#pod
-conditions
// More info: http://kubernetes.io/docs/user-guide/
carp-states#carp
-conditions
optional
string
status
=
2
;
// Last time we probed the condition.
...
...
@@ -85,43 +85,43 @@ message CarpList {
// +optional
optional
k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta
metadata
=
1
;
// List of
pod
s.
// More info: http://kubernetes.io/docs/user-guide/
pod
s
// List of
carp
s.
// More info: http://kubernetes.io/docs/user-guide/
carp
s
repeated
Carp
items
=
2
;
}
// CarpSpec is a description of a
pod
// CarpSpec is a description of a
carp
message
CarpSpec
{
// Restart policy for all containers within the
pod
.
// Restart policy for all containers within the
carp
.
// One of Always, OnFailure, Never.
// Default to Always.
// More info: http://kubernetes.io/docs/user-guide/
pod
-states#restartpolicy
// More info: http://kubernetes.io/docs/user-guide/
carp
-states#restartpolicy
// +optional
optional
string
restartPolicy
=
3
;
// Optional duration in seconds the
pod
needs to terminate gracefully. May be decreased in delete request.
// Optional duration in seconds the
carp
needs to terminate gracefully. May be decreased in delete request.
// Value must be non-negative integer. The value zero indicates delete immediately.
// If this value is nil, the default grace period will be used instead.
// The grace period is the duration in seconds after the processes running in the
pod
are sent
// The grace period is the duration in seconds after the processes running in the
carp
are sent
// a termination signal and the time when the processes are forcibly halted with a kill signal.
// Set this value longer than the expected cleanup time for your process.
// Defaults to 30 seconds.
// +optional
optional
int64
terminationGracePeriodSeconds
=
4
;
// Optional duration in seconds the
pod
may be active on the node relative to
// Optional duration in seconds the
carp
may be active on the node relative to
// StartTime before the system will actively try to mark it failed and kill associated containers.
// Value must be a positive integer.
// +optional
optional
int64
activeDeadlineSeconds
=
5
;
// NodeSelector is a selector which must be true for the
pod
to fit on a node.
// Selector which must match a node's labels for the
pod
to be scheduled on that node.
// NodeSelector is a selector which must be true for the
carp
to fit on a node.
// Selector which must match a node's labels for the
carp
to be scheduled on that node.
// More info: http://kubernetes.io/docs/user-guide/node-selection/README
// +optional
map
<
string
,
string
>
nodeSelector
=
7
;
// ServiceAccountName is the name of the ServiceAccount to use to run this
pod
.
// ServiceAccountName is the name of the ServiceAccount to use to run this
carp
.
// More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md
// +optional
optional
string
serviceAccountName
=
8
;
...
...
@@ -132,13 +132,13 @@ message CarpSpec {
// +optional
optional
string
serviceAccount
=
9
;
// NodeName is a request to schedule this
pod
onto a specific node. If it is non-empty,
// the scheduler simply schedules this
pod
onto that node, assuming that it fits resource
// NodeName is a request to schedule this
carp
onto a specific node. If it is non-empty,
// the scheduler simply schedules this
carp
onto that node, assuming that it fits resource
// requirements.
// +optional
optional
string
nodeName
=
10
;
// Host networking requested for this
pod
. Use the host's network namespace.
// Host networking requested for this
carp
. Use the host's network namespace.
// If this option is set, the ports that will be used must be specified.
// Default to false.
// +k8s:conversion-gen=false
...
...
@@ -158,54 +158,54 @@ message CarpSpec {
optional
bool
hostIPC
=
13
;
// Specifies the hostname of the Carp
// If not specified, the
pod
's hostname will be set to a system-defined value.
// If not specified, the
carp
's hostname will be set to a system-defined value.
// +optional
optional
string
hostname
=
16
;
// If specified, the fully qualified Carp hostname will be "<hostname>.<subdomain>.<
pod
namespace>.svc.<cluster domain>".
// If not specified, the
pod
will not have a domainname at all.
// If specified, the fully qualified Carp hostname will be "<hostname>.<subdomain>.<
carp
namespace>.svc.<cluster domain>".
// If not specified, the
carp
will not have a domainname at all.
// +optional
optional
string
subdomain
=
17
;
// If specified, the
pod
will be dispatched by specified scheduler.
// If not specified, the
pod
will be dispatched by default scheduler.
// If specified, the
carp
will be dispatched by specified scheduler.
// If not specified, the
carp
will be dispatched by default scheduler.
// +optional
optional
string
schedulername
=
19
;
}
// CarpStatus represents information about the status of a
pod
. Status may trail the actual
// CarpStatus represents information about the status of a
carp
. Status may trail the actual
// state of a system.
message
CarpStatus
{
// Current condition of the
pod
.
// More info: http://kubernetes.io/docs/user-guide/
pod-states#pod
-phase
// Current condition of the
carp
.
// More info: http://kubernetes.io/docs/user-guide/
carp-states#carp
-phase
// +optional
optional
string
phase
=
1
;
// Current service state of
pod
.
// More info: http://kubernetes.io/docs/user-guide/
pod-states#pod
-conditions
// Current service state of
carp
.
// More info: http://kubernetes.io/docs/user-guide/
carp-states#carp
-conditions
// +optional
repeated
CarpCondition
conditions
=
2
;
// A human readable message indicating details about why the
pod
is in this condition.
// A human readable message indicating details about why the
carp
is in this condition.
// +optional
optional
string
message
=
3
;
// A brief CamelCase message indicating details about why the
pod
is in this state.
// A brief CamelCase message indicating details about why the
carp
is in this state.
// e.g. 'OutOfDisk'
// +optional
optional
string
reason
=
4
;
// IP address of the host to which the
pod
is assigned. Empty if not yet scheduled.
// IP address of the host to which the
carp
is assigned. Empty if not yet scheduled.
// +optional
optional
string
hostIP
=
5
;
// IP address allocated to the
pod
. Routable at least within the cluster.
// IP address allocated to the
carp
. Routable at least within the cluster.
// Empty if not yet allocated.
// +optional
optional
string
pod
IP
=
6
;
optional
string
carp
IP
=
6
;
// RFC 3339 date and time at which the object was acknowledged by the Kubelet.
// This is before the Kubelet pulled the container image(s) for the
pod
.
// This is before the Kubelet pulled the container image(s) for the
carp
.
// +optional
optional
k8s.io.apimachinery.pkg.apis.meta.v1.Time
startTime
=
7
;
}
...
...
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/register.go
View file @
9ac39849
...
...
@@ -23,7 +23,7 @@ import (
)
// GroupName is the group name use in this package
const
GroupName
=
"
example.apiserver
.k8s.io"
const
GroupName
=
"
testapigroup.apimachinery
.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
"v1"
}
...
...
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/types.generated.go
View file @
9ac39849
...
...
@@ -739,7 +739,7 @@ func (x *CarpStatus) CodecEncodeSelf(e *codec1978.Encoder) {
}
else
{
if
yyq2
[
5
]
{
z
.
EncSendContainerState
(
codecSelfer_containerMapKey1234
)
r
.
EncodeString
(
codecSelferC_UTF81234
,
string
(
"
pod
IP"
))
r
.
EncodeString
(
codecSelferC_UTF81234
,
string
(
"
carp
IP"
))
z
.
EncSendContainerState
(
codecSelfer_containerMapValue1234
)
yym20
:=
z
.
EncBinary
()
_
=
yym20
...
...
@@ -908,7 +908,7 @@ func (x *CarpStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
*
((
*
string
)(
yyv11
))
=
r
.
DecodeString
()
}
}
case
"
pod
IP"
:
case
"
carp
IP"
:
if
r
.
TryDecodeAsNil
()
{
x
.
CarpIP
=
""
}
else
{
...
...
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/types.go
View file @
9ac39849
...
...
@@ -35,12 +35,12 @@ type Carp struct {
// +optional
metav1
.
ObjectMeta
`json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the desired behavior of the
pod
.
// Specification of the desired behavior of the
carp
.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
// +optional
Spec
CarpSpec
`json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Most recently observed status of the
pod
.
// Most recently observed status of the
carp
.
// This data may not be up to date.
// Populated by the system.
// Read-only.
...
...
@@ -49,35 +49,35 @@ type Carp struct {
Status
CarpStatus
`json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// CarpStatus represents information about the status of a
pod
. Status may trail the actual
// CarpStatus represents information about the status of a
carp
. Status may trail the actual
// state of a system.
type
CarpStatus
struct
{
// Current condition of the
pod
.
// More info: http://kubernetes.io/docs/user-guide/
pod-states#pod
-phase
// Current condition of the
carp
.
// More info: http://kubernetes.io/docs/user-guide/
carp-states#carp
-phase
// +optional
Phase
CarpPhase
`json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=CarpPhase"`
// Current service state of
pod
.
// More info: http://kubernetes.io/docs/user-guide/
pod-states#pod
-conditions
// Current service state of
carp
.
// More info: http://kubernetes.io/docs/user-guide/
carp-states#carp
-conditions
// +optional
Conditions
[]
CarpCondition
`json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
// A human readable message indicating details about why the
pod
is in this condition.
// A human readable message indicating details about why the
carp
is in this condition.
// +optional
Message
string
`json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
// A brief CamelCase message indicating details about why the
pod
is in this state.
// A brief CamelCase message indicating details about why the
carp
is in this state.
// e.g. 'OutOfDisk'
// +optional
Reason
string
`json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// IP address of the host to which the
pod
is assigned. Empty if not yet scheduled.
// IP address of the host to which the
carp
is assigned. Empty if not yet scheduled.
// +optional
HostIP
string
`json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"`
// IP address allocated to the
pod
. Routable at least within the cluster.
// IP address allocated to the
carp
. Routable at least within the cluster.
// Empty if not yet allocated.
// +optional
CarpIP
string
`json:"
podIP,omitempty" protobuf:"bytes,6,opt,name=pod
IP"`
CarpIP
string
`json:"
carpIP,omitempty" protobuf:"bytes,6,opt,name=carp
IP"`
// RFC 3339 date and time at which the object was acknowledged by the Kubelet.
// This is before the Kubelet pulled the container image(s) for the
pod
.
// This is before the Kubelet pulled the container image(s) for the
carp
.
// +optional
StartTime
*
metav1
.
Time
`json:"startTime,omitempty" protobuf:"bytes,7,opt,name=startTime"`
}
...
...
@@ -85,11 +85,11 @@ type CarpStatus struct {
type
CarpCondition
struct
{
// Type is the type of the condition.
// Currently only Ready.
// More info: http://kubernetes.io/docs/user-guide/
pod-states#pod
-conditions
// More info: http://kubernetes.io/docs/user-guide/
carp-states#carp
-conditions
Type
CarpConditionType
`json:"type" protobuf:"bytes,1,opt,name=type,casttype=CarpConditionType"`
// Status is the status of the condition.
// Can be True, False, Unknown.
// More info: http://kubernetes.io/docs/user-guide/
pod-states#pod
-conditions
// More info: http://kubernetes.io/docs/user-guide/
carp-states#carp
-conditions
Status
ConditionStatus
`json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
// Last time we probed the condition.
// +optional
...
...
@@ -105,35 +105,35 @@ type CarpCondition struct {
Message
string
`json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
}
// CarpSpec is a description of a
pod
// CarpSpec is a description of a
carp
type
CarpSpec
struct
{
// Restart policy for all containers within the
pod
.
// Restart policy for all containers within the
carp
.
// One of Always, OnFailure, Never.
// Default to Always.
// More info: http://kubernetes.io/docs/user-guide/
pod
-states#restartpolicy
// More info: http://kubernetes.io/docs/user-guide/
carp
-states#restartpolicy
// +optional
RestartPolicy
RestartPolicy
`json:"restartPolicy,omitempty" protobuf:"bytes,3,opt,name=restartPolicy,casttype=RestartPolicy"`
// Optional duration in seconds the
pod
needs to terminate gracefully. May be decreased in delete request.
// Optional duration in seconds the
carp
needs to terminate gracefully. May be decreased in delete request.
// Value must be non-negative integer. The value zero indicates delete immediately.
// If this value is nil, the default grace period will be used instead.
// The grace period is the duration in seconds after the processes running in the
pod
are sent
// The grace period is the duration in seconds after the processes running in the
carp
are sent
// a termination signal and the time when the processes are forcibly halted with a kill signal.
// Set this value longer than the expected cleanup time for your process.
// Defaults to 30 seconds.
// +optional
TerminationGracePeriodSeconds
*
int64
`json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"`
// Optional duration in seconds the
pod
may be active on the node relative to
// Optional duration in seconds the
carp
may be active on the node relative to
// StartTime before the system will actively try to mark it failed and kill associated containers.
// Value must be a positive integer.
// +optional
ActiveDeadlineSeconds
*
int64
`json:"activeDeadlineSeconds,omitempty" protobuf:"varint,5,opt,name=activeDeadlineSeconds"`
// NodeSelector is a selector which must be true for the
pod
to fit on a node.
// Selector which must match a node's labels for the
pod
to be scheduled on that node.
// NodeSelector is a selector which must be true for the
carp
to fit on a node.
// Selector which must match a node's labels for the
carp
to be scheduled on that node.
// More info: http://kubernetes.io/docs/user-guide/node-selection/README
// +optional
NodeSelector
map
[
string
]
string
`json:"nodeSelector,omitempty" protobuf:"bytes,7,rep,name=nodeSelector"`
// ServiceAccountName is the name of the ServiceAccount to use to run this
pod
.
// ServiceAccountName is the name of the ServiceAccount to use to run this
carp
.
// More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md
// +optional
ServiceAccountName
string
`json:"serviceAccountName,omitempty" protobuf:"bytes,8,opt,name=serviceAccountName"`
...
...
@@ -143,12 +143,12 @@ type CarpSpec struct {
// +optional
DeprecatedServiceAccount
string
`json:"serviceAccount,omitempty" protobuf:"bytes,9,opt,name=serviceAccount"`
// NodeName is a request to schedule this
pod
onto a specific node. If it is non-empty,
// the scheduler simply schedules this
pod
onto that node, assuming that it fits resource
// NodeName is a request to schedule this
carp
onto a specific node. If it is non-empty,
// the scheduler simply schedules this
carp
onto that node, assuming that it fits resource
// requirements.
// +optional
NodeName
string
`json:"nodeName,omitempty" protobuf:"bytes,10,opt,name=nodeName"`
// Host networking requested for this
pod
. Use the host's network namespace.
// Host networking requested for this
carp
. Use the host's network namespace.
// If this option is set, the ports that will be used must be specified.
// Default to false.
// +k8s:conversion-gen=false
...
...
@@ -165,15 +165,15 @@ type CarpSpec struct {
// +optional
HostIPC
bool
`json:"hostIPC,omitempty" protobuf:"varint,13,opt,name=hostIPC"`
// Specifies the hostname of the Carp
// If not specified, the
pod
's hostname will be set to a system-defined value.
// If not specified, the
carp
's hostname will be set to a system-defined value.
// +optional
Hostname
string
`json:"hostname,omitempty" protobuf:"bytes,16,opt,name=hostname"`
// If specified, the fully qualified Carp hostname will be "<hostname>.<subdomain>.<
pod
namespace>.svc.<cluster domain>".
// If not specified, the
pod
will not have a domainname at all.
// If specified, the fully qualified Carp hostname will be "<hostname>.<subdomain>.<
carp
namespace>.svc.<cluster domain>".
// If not specified, the
carp
will not have a domainname at all.
// +optional
Subdomain
string
`json:"subdomain,omitempty" protobuf:"bytes,17,opt,name=subdomain"`
// If specified, the
pod
will be dispatched by specified scheduler.
// If not specified, the
pod
will be dispatched by default scheduler.
// If specified, the
carp
will be dispatched by specified scheduler.
// If not specified, the
carp
will be dispatched by default scheduler.
// +optional
SchedulerName
string
`json:"schedulername,omitempty" protobuf:"bytes,19,opt,name=schedulername"`
}
...
...
@@ -186,7 +186,7 @@ type CarpList struct {
// +optional
metav1
.
ListMeta
`json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of
pod
s.
// More info: http://kubernetes.io/docs/user-guide/
pod
s
// List of
carp
s.
// More info: http://kubernetes.io/docs/user-guide/
carp
s
Items
[]
Carp
`json:"items" protobuf:"bytes,2,rep,name=items"`
}
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.conversion.go
View file @
9ac39849
...
...
@@ -21,7 +21,11 @@ limitations under the License.
package
v1
import
(
meta_v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
testapigroup
"k8s.io/apimachinery/pkg/apis/testapigroup"
conversion
"k8s.io/apimachinery/pkg/conversion"
runtime
"k8s.io/apimachinery/pkg/runtime"
unsafe
"unsafe"
)
func
init
()
{
...
...
@@ -31,5 +35,192 @@ func init() {
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func
RegisterConversions
(
scheme
*
runtime
.
Scheme
)
error
{
return
scheme
.
AddGeneratedConversionFuncs
()
return
scheme
.
AddGeneratedConversionFuncs
(
Convert_v1_Carp_To_testapigroup_Carp
,
Convert_testapigroup_Carp_To_v1_Carp
,
Convert_v1_CarpCondition_To_testapigroup_CarpCondition
,
Convert_testapigroup_CarpCondition_To_v1_CarpCondition
,
Convert_v1_CarpList_To_testapigroup_CarpList
,
Convert_testapigroup_CarpList_To_v1_CarpList
,
Convert_v1_CarpSpec_To_testapigroup_CarpSpec
,
Convert_testapigroup_CarpSpec_To_v1_CarpSpec
,
Convert_v1_CarpStatus_To_testapigroup_CarpStatus
,
Convert_testapigroup_CarpStatus_To_v1_CarpStatus
,
)
}
func
autoConvert_v1_Carp_To_testapigroup_Carp
(
in
*
Carp
,
out
*
testapigroup
.
Carp
,
s
conversion
.
Scope
)
error
{
out
.
ObjectMeta
=
in
.
ObjectMeta
if
err
:=
Convert_v1_CarpSpec_To_testapigroup_CarpSpec
(
&
in
.
Spec
,
&
out
.
Spec
,
s
);
err
!=
nil
{
return
err
}
if
err
:=
Convert_v1_CarpStatus_To_testapigroup_CarpStatus
(
&
in
.
Status
,
&
out
.
Status
,
s
);
err
!=
nil
{
return
err
}
return
nil
}
// Convert_v1_Carp_To_testapigroup_Carp is an autogenerated conversion function.
func
Convert_v1_Carp_To_testapigroup_Carp
(
in
*
Carp
,
out
*
testapigroup
.
Carp
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_Carp_To_testapigroup_Carp
(
in
,
out
,
s
)
}
func
autoConvert_testapigroup_Carp_To_v1_Carp
(
in
*
testapigroup
.
Carp
,
out
*
Carp
,
s
conversion
.
Scope
)
error
{
out
.
ObjectMeta
=
in
.
ObjectMeta
if
err
:=
Convert_testapigroup_CarpSpec_To_v1_CarpSpec
(
&
in
.
Spec
,
&
out
.
Spec
,
s
);
err
!=
nil
{
return
err
}
if
err
:=
Convert_testapigroup_CarpStatus_To_v1_CarpStatus
(
&
in
.
Status
,
&
out
.
Status
,
s
);
err
!=
nil
{
return
err
}
return
nil
}
// Convert_testapigroup_Carp_To_v1_Carp is an autogenerated conversion function.
func
Convert_testapigroup_Carp_To_v1_Carp
(
in
*
testapigroup
.
Carp
,
out
*
Carp
,
s
conversion
.
Scope
)
error
{
return
autoConvert_testapigroup_Carp_To_v1_Carp
(
in
,
out
,
s
)
}
func
autoConvert_v1_CarpCondition_To_testapigroup_CarpCondition
(
in
*
CarpCondition
,
out
*
testapigroup
.
CarpCondition
,
s
conversion
.
Scope
)
error
{
out
.
Type
=
testapigroup
.
CarpConditionType
(
in
.
Type
)
out
.
Status
=
testapigroup
.
ConditionStatus
(
in
.
Status
)
out
.
LastProbeTime
=
in
.
LastProbeTime
out
.
LastTransitionTime
=
in
.
LastTransitionTime
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
return
nil
}
// Convert_v1_CarpCondition_To_testapigroup_CarpCondition is an autogenerated conversion function.
func
Convert_v1_CarpCondition_To_testapigroup_CarpCondition
(
in
*
CarpCondition
,
out
*
testapigroup
.
CarpCondition
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_CarpCondition_To_testapigroup_CarpCondition
(
in
,
out
,
s
)
}
func
autoConvert_testapigroup_CarpCondition_To_v1_CarpCondition
(
in
*
testapigroup
.
CarpCondition
,
out
*
CarpCondition
,
s
conversion
.
Scope
)
error
{
out
.
Type
=
CarpConditionType
(
in
.
Type
)
out
.
Status
=
ConditionStatus
(
in
.
Status
)
out
.
LastProbeTime
=
in
.
LastProbeTime
out
.
LastTransitionTime
=
in
.
LastTransitionTime
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
return
nil
}
// Convert_testapigroup_CarpCondition_To_v1_CarpCondition is an autogenerated conversion function.
func
Convert_testapigroup_CarpCondition_To_v1_CarpCondition
(
in
*
testapigroup
.
CarpCondition
,
out
*
CarpCondition
,
s
conversion
.
Scope
)
error
{
return
autoConvert_testapigroup_CarpCondition_To_v1_CarpCondition
(
in
,
out
,
s
)
}
func
autoConvert_v1_CarpList_To_testapigroup_CarpList
(
in
*
CarpList
,
out
*
testapigroup
.
CarpList
,
s
conversion
.
Scope
)
error
{
out
.
ListMeta
=
in
.
ListMeta
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
testapigroup
.
Carp
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
err
:=
Convert_v1_Carp_To_testapigroup_Carp
(
&
(
*
in
)[
i
],
&
(
*
out
)[
i
],
s
);
err
!=
nil
{
return
err
}
}
}
else
{
out
.
Items
=
nil
}
return
nil
}
// Convert_v1_CarpList_To_testapigroup_CarpList is an autogenerated conversion function.
func
Convert_v1_CarpList_To_testapigroup_CarpList
(
in
*
CarpList
,
out
*
testapigroup
.
CarpList
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_CarpList_To_testapigroup_CarpList
(
in
,
out
,
s
)
}
func
autoConvert_testapigroup_CarpList_To_v1_CarpList
(
in
*
testapigroup
.
CarpList
,
out
*
CarpList
,
s
conversion
.
Scope
)
error
{
out
.
ListMeta
=
in
.
ListMeta
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
Carp
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
err
:=
Convert_testapigroup_Carp_To_v1_Carp
(
&
(
*
in
)[
i
],
&
(
*
out
)[
i
],
s
);
err
!=
nil
{
return
err
}
}
}
else
{
out
.
Items
=
make
([]
Carp
,
0
)
}
return
nil
}
// Convert_testapigroup_CarpList_To_v1_CarpList is an autogenerated conversion function.
func
Convert_testapigroup_CarpList_To_v1_CarpList
(
in
*
testapigroup
.
CarpList
,
out
*
CarpList
,
s
conversion
.
Scope
)
error
{
return
autoConvert_testapigroup_CarpList_To_v1_CarpList
(
in
,
out
,
s
)
}
func
autoConvert_v1_CarpSpec_To_testapigroup_CarpSpec
(
in
*
CarpSpec
,
out
*
testapigroup
.
CarpSpec
,
s
conversion
.
Scope
)
error
{
out
.
RestartPolicy
=
testapigroup
.
RestartPolicy
(
in
.
RestartPolicy
)
out
.
TerminationGracePeriodSeconds
=
(
*
int64
)(
unsafe
.
Pointer
(
in
.
TerminationGracePeriodSeconds
))
out
.
ActiveDeadlineSeconds
=
(
*
int64
)(
unsafe
.
Pointer
(
in
.
ActiveDeadlineSeconds
))
out
.
NodeSelector
=
*
(
*
map
[
string
]
string
)(
unsafe
.
Pointer
(
&
in
.
NodeSelector
))
out
.
ServiceAccountName
=
in
.
ServiceAccountName
// INFO: in.DeprecatedServiceAccount opted out of conversion generation
out
.
NodeName
=
in
.
NodeName
// INFO: in.HostNetwork opted out of conversion generation
// INFO: in.HostPID opted out of conversion generation
// INFO: in.HostIPC opted out of conversion generation
out
.
Hostname
=
in
.
Hostname
out
.
Subdomain
=
in
.
Subdomain
out
.
SchedulerName
=
in
.
SchedulerName
return
nil
}
// Convert_v1_CarpSpec_To_testapigroup_CarpSpec is an autogenerated conversion function.
func
Convert_v1_CarpSpec_To_testapigroup_CarpSpec
(
in
*
CarpSpec
,
out
*
testapigroup
.
CarpSpec
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_CarpSpec_To_testapigroup_CarpSpec
(
in
,
out
,
s
)
}
func
autoConvert_testapigroup_CarpSpec_To_v1_CarpSpec
(
in
*
testapigroup
.
CarpSpec
,
out
*
CarpSpec
,
s
conversion
.
Scope
)
error
{
out
.
RestartPolicy
=
RestartPolicy
(
in
.
RestartPolicy
)
out
.
TerminationGracePeriodSeconds
=
(
*
int64
)(
unsafe
.
Pointer
(
in
.
TerminationGracePeriodSeconds
))
out
.
ActiveDeadlineSeconds
=
(
*
int64
)(
unsafe
.
Pointer
(
in
.
ActiveDeadlineSeconds
))
out
.
NodeSelector
=
*
(
*
map
[
string
]
string
)(
unsafe
.
Pointer
(
&
in
.
NodeSelector
))
out
.
ServiceAccountName
=
in
.
ServiceAccountName
out
.
NodeName
=
in
.
NodeName
out
.
Hostname
=
in
.
Hostname
out
.
Subdomain
=
in
.
Subdomain
out
.
SchedulerName
=
in
.
SchedulerName
return
nil
}
// Convert_testapigroup_CarpSpec_To_v1_CarpSpec is an autogenerated conversion function.
func
Convert_testapigroup_CarpSpec_To_v1_CarpSpec
(
in
*
testapigroup
.
CarpSpec
,
out
*
CarpSpec
,
s
conversion
.
Scope
)
error
{
return
autoConvert_testapigroup_CarpSpec_To_v1_CarpSpec
(
in
,
out
,
s
)
}
func
autoConvert_v1_CarpStatus_To_testapigroup_CarpStatus
(
in
*
CarpStatus
,
out
*
testapigroup
.
CarpStatus
,
s
conversion
.
Scope
)
error
{
out
.
Phase
=
testapigroup
.
CarpPhase
(
in
.
Phase
)
out
.
Conditions
=
*
(
*
[]
testapigroup
.
CarpCondition
)(
unsafe
.
Pointer
(
&
in
.
Conditions
))
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
CarpIP
=
in
.
CarpIP
out
.
StartTime
=
(
*
meta_v1
.
Time
)(
unsafe
.
Pointer
(
in
.
StartTime
))
return
nil
}
// Convert_v1_CarpStatus_To_testapigroup_CarpStatus is an autogenerated conversion function.
func
Convert_v1_CarpStatus_To_testapigroup_CarpStatus
(
in
*
CarpStatus
,
out
*
testapigroup
.
CarpStatus
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_CarpStatus_To_testapigroup_CarpStatus
(
in
,
out
,
s
)
}
func
autoConvert_testapigroup_CarpStatus_To_v1_CarpStatus
(
in
*
testapigroup
.
CarpStatus
,
out
*
CarpStatus
,
s
conversion
.
Scope
)
error
{
out
.
Phase
=
CarpPhase
(
in
.
Phase
)
out
.
Conditions
=
*
(
*
[]
CarpCondition
)(
unsafe
.
Pointer
(
&
in
.
Conditions
))
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
CarpIP
=
in
.
CarpIP
out
.
StartTime
=
(
*
meta_v1
.
Time
)(
unsafe
.
Pointer
(
in
.
StartTime
))
return
nil
}
// Convert_testapigroup_CarpStatus_To_v1_CarpStatus is an autogenerated conversion function.
func
Convert_testapigroup_CarpStatus_To_v1_CarpStatus
(
in
*
testapigroup
.
CarpStatus
,
out
*
CarpStatus
,
s
conversion
.
Scope
)
error
{
return
autoConvert_testapigroup_CarpStatus_To_v1_CarpStatus
(
in
,
out
,
s
)
}
staging/src/k8s.io/apimachinery/pkg/test/api_meta_help_test.go
View file @
9ac39849
...
...
@@ -26,7 +26,7 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
example
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/diff"
...
...
@@ -37,8 +37,8 @@ func TestIsList(t *testing.T) {
obj
runtime
.
Object
isList
bool
}{
{
&
example
.
CarpList
{},
true
},
{
&
example
.
Carp
{},
false
},
{
&
testapigroup
.
CarpList
{},
true
},
{
&
testapigroup
.
Carp
{},
false
},
}
for
_
,
item
:=
range
tests
{
if
e
,
a
:=
item
.
isList
,
meta
.
IsListType
(
item
.
obj
);
e
!=
a
{
...
...
@@ -49,8 +49,8 @@ func TestIsList(t *testing.T) {
func
TestExtractList
(
t
*
testing
.
T
)
{
list1
:=
[]
runtime
.
Object
{
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
}
list2
:=
&
v1
.
List
{
Items
:
[]
runtime
.
RawExtension
{
...
...
@@ -60,13 +60,13 @@ func TestExtractList(t *testing.T) {
},
}
list3
:=
&
fakePtrValueList
{
Items
:
[]
*
example
.
Carp
{
Items
:
[]
*
testapigroup
.
Carp
{
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
},
}
list4
:=
&
example
.
CarpList
{
Items
:
[]
example
.
Carp
{
list4
:=
&
testapigroup
.
CarpList
{
Items
:
[]
testapigroup
.
Carp
{
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"3"
}},
...
...
@@ -142,8 +142,8 @@ func TestExtractList(t *testing.T) {
func
TestEachListItem
(
t
*
testing
.
T
)
{
list1
:=
[]
runtime
.
Object
{
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
}
list2
:=
&
v1
.
List
{
Items
:
[]
runtime
.
RawExtension
{
...
...
@@ -153,13 +153,13 @@ func TestEachListItem(t *testing.T) {
},
}
list3
:=
&
fakePtrValueList
{
Items
:
[]
*
example
.
Carp
{
Items
:
[]
*
testapigroup
.
Carp
{
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
},
}
list4
:=
&
example
.
CarpList
{
Items
:
[]
example
.
Carp
{
list4
:=
&
testapigroup
.
CarpList
{
Items
:
[]
testapigroup
.
Carp
{
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"3"
}},
...
...
@@ -252,7 +252,7 @@ func TestExtractListOfInterfacePtrs(t *testing.T) {
}
type
fakePtrValueList
struct
{
Items
[]
*
example
.
Carp
Items
[]
*
testapigroup
.
Carp
}
func
(
obj
fakePtrValueList
)
GetObjectKind
()
schema
.
ObjectKind
{
...
...
@@ -260,11 +260,11 @@ func (obj fakePtrValueList) GetObjectKind() schema.ObjectKind {
}
func
TestSetList
(
t
*
testing
.
T
)
{
pl
:=
&
example
.
CarpList
{}
pl
:=
&
testapigroup
.
CarpList
{}
list
:=
[]
runtime
.
Object
{
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"3"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"3"
}},
}
err
:=
meta
.
SetList
(
pl
,
list
)
if
err
!=
nil
{
...
...
@@ -274,7 +274,7 @@ func TestSetList(t *testing.T) {
t
.
Fatalf
(
"Expected %v, got %v"
,
e
,
a
)
}
for
i
:=
range
list
{
if
e
,
a
:=
list
[
i
]
.
(
*
example
.
Carp
)
.
Name
,
pl
.
Items
[
i
]
.
Name
;
e
!=
a
{
if
e
,
a
:=
list
[
i
]
.
(
*
testapigroup
.
Carp
)
.
Name
,
pl
.
Items
[
i
]
.
Name
;
e
!=
a
{
t
.
Fatalf
(
"Expected %v, got %v"
,
e
,
a
)
}
}
...
...
@@ -283,9 +283,9 @@ func TestSetList(t *testing.T) {
func
TestSetListToRuntimeObjectArray
(
t
*
testing
.
T
)
{
pl
:=
&
List
{}
list
:=
[]
runtime
.
Object
{
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"3"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"2"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"3"
}},
}
err
:=
meta
.
SetList
(
pl
,
list
)
if
err
!=
nil
{
...
...
@@ -325,7 +325,7 @@ func TestSetListToMatchingType(t *testing.T) {
func
TestSetExtractListRoundTrip
(
t
*
testing
.
T
)
{
fuzzer
:=
fuzz
.
New
()
.
NilChance
(
0
)
.
NumElements
(
1
,
5
)
for
i
:=
0
;
i
<
5
;
i
++
{
start
:=
&
example
.
CarpList
{}
start
:=
&
testapigroup
.
CarpList
{}
fuzzer
.
Fuzz
(
&
start
.
Items
)
list
,
err
:=
meta
.
ExtractList
(
start
)
...
...
@@ -333,7 +333,7 @@ func TestSetExtractListRoundTrip(t *testing.T) {
t
.
Errorf
(
"Unexpected error %v"
,
err
)
continue
}
got
:=
&
example
.
CarpList
{}
got
:=
&
testapigroup
.
CarpList
{}
err
=
meta
.
SetList
(
got
,
list
)
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error %v"
,
err
)
...
...
staging/src/k8s.io/apimachinery/pkg/test/api_meta_meta_test.go
View file @
9ac39849
...
...
@@ -24,14 +24,14 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
example
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
)
func
TestAPIObjectMeta
(
t
*
testing
.
T
)
{
j
:=
&
example
.
Carp
{
j
:=
&
testapigroup
.
Carp
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"/a"
,
Kind
:
"b"
},
ObjectMeta
:
metav1
.
ObjectMeta
{
Namespace
:
"bar"
,
...
...
@@ -394,7 +394,7 @@ func TestAccessOwnerReferences(t *testing.T) {
// BenchmarkAccessorSetFastPath shows the interface fast path
func
BenchmarkAccessorSetFastPath
(
b
*
testing
.
B
)
{
obj
:=
&
example
.
Carp
{
obj
:=
&
testapigroup
.
Carp
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
"/a"
,
Kind
:
"b"
},
ObjectMeta
:
metav1
.
ObjectMeta
{
Namespace
:
"bar"
,
...
...
staging/src/k8s.io/apimachinery/pkg/test/apis_meta_v1_unstructed_unstructure_test.go
View file @
9ac39849
...
...
@@ -27,7 +27,7 @@ import (
apitesting
"k8s.io/apimachinery/pkg/api/testing"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
example
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
...
...
@@ -38,7 +38,7 @@ func TestDecodeUnstructured(t *testing.T) {
rawJson
:=
fmt
.
Sprintf
(
`{"kind":"Pod","apiVersion":"%s","metadata":{"name":"test"}}`
,
groupVersionString
)
pl
:=
&
List
{
Items
:
[]
runtime
.
Object
{
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Pod"
,
APIVersion
:
groupVersionString
},
Raw
:
[]
byte
(
rawJson
),
...
...
@@ -458,7 +458,7 @@ func TestDecodeNumbers(t *testing.T) {
}
}`
)
pod
:=
&
example
.
Carp
{}
pod
:=
&
testapigroup
.
Carp
{}
_
,
codecs
:=
TestScheme
()
codec
:=
apitesting
.
TestCodec
(
codecs
,
schema
.
GroupVersion
{
Group
:
""
,
Version
:
runtime
.
APIVersionInternal
})
...
...
@@ -489,7 +489,7 @@ func TestDecodeNumbers(t *testing.T) {
t
.
Fatalf
(
"unexpected error: %v"
,
err
)
}
// ensure pod is still valid
pod2
,
ok
:=
obj2
.
(
*
example
.
Carp
)
pod2
,
ok
:=
obj2
.
(
*
testapigroup
.
Carp
)
if
!
ok
{
t
.
Fatalf
(
"expected an *api.Pod, got %#v"
,
obj2
)
}
...
...
staging/src/k8s.io/apimachinery/pkg/test/runtime_helper_test.go
View file @
9ac39849
...
...
@@ -21,14 +21,14 @@ import (
apitesting
"k8s.io/apimachinery/pkg/api/testing"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
example
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/runtime"
)
func
TestDecodeList
(
t
*
testing
.
T
)
{
pl
:=
List
{
Items
:
[]
runtime
.
Object
{
&
example
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
testapigroup
.
Carp
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"1"
}},
&
runtime
.
Unknown
{
TypeMeta
:
runtime
.
TypeMeta
{
Kind
:
"Carp"
,
APIVersion
:
"v1"
},
Raw
:
[]
byte
(
`{"kind":"Carp","apiVersion":"`
+
"v1"
+
`","metadata":{"name":"test"}}`
),
...
...
@@ -38,12 +38,12 @@ func TestDecodeList(t *testing.T) {
}
_
,
codecs
:=
TestScheme
()
Codec
:=
apitesting
.
TestCodec
(
codecs
,
example
.
SchemeGroupVersion
)
Codec
:=
apitesting
.
TestCodec
(
codecs
,
testapigroup
.
SchemeGroupVersion
)
if
errs
:=
runtime
.
DecodeList
(
pl
.
Items
,
Codec
);
len
(
errs
)
!=
0
{
t
.
Fatalf
(
"unexpected error %v"
,
errs
)
}
if
pod
,
ok
:=
pl
.
Items
[
1
]
.
(
*
example
.
Carp
);
!
ok
||
pod
.
Name
!=
"test"
{
if
pod
,
ok
:=
pl
.
Items
[
1
]
.
(
*
testapigroup
.
Carp
);
!
ok
||
pod
.
Name
!=
"test"
{
t
.
Errorf
(
"object not converted: %#v"
,
pl
.
Items
[
1
])
}
}
staging/src/k8s.io/apimachinery/pkg/test/util.go
View file @
9ac39849
...
...
@@ -18,8 +18,8 @@ package test
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
example
"k8s.io/apimachinery/pkg/apis/testapigroup"
examplev1
"k8s.io/apimachinery/pkg/apis/testapigroup/v1"
"k8s.io/apimachinery/pkg/apis/testapigroup"
"k8s.io/apimachinery/pkg/apis/testapigroup/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
apiserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
...
...
@@ -40,17 +40,17 @@ func TestScheme() (*runtime.Scheme, apiserializer.CodecFactory) {
scheme
:=
runtime
.
NewScheme
()
scheme
.
AddKnownTypes
(
internalGV
,
&
example
.
Carp
{},
&
example
.
CarpList
{},
&
testapigroup
.
Carp
{},
&
testapigroup
.
CarpList
{},
&
List
{},
)
scheme
.
AddKnownTypes
(
externalGV
,
&
example
v1
.
Carp
{},
&
example
v1
.
CarpList
{},
&
v1
.
Carp
{},
&
v1
.
CarpList
{},
&
List
{},
)
example
.
AddToScheme
(
scheme
)
example
v1
.
AddToScheme
(
scheme
)
testapigroup
.
AddToScheme
(
scheme
)
v1
.
AddToScheme
(
scheme
)
codecs
:=
apiserializer
.
NewCodecFactory
(
scheme
)
return
scheme
,
codecs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment