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
161ca53f
Commit
161ca53f
authored
Jan 31, 2017
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
k8s.io/apiserver: add example api group
parent
5486c6a5
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1423 additions
and
37 deletions
+1423
-37
cmd.go
cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
+1
-0
fuzzer.go
pkg/api/testing/fuzzer.go
+7
-35
fuzzer.go
staging/src/k8s.io/apimachinery/pkg/api/testing/fuzzer.go
+29
-2
doc.go
staging/src/k8s.io/apiserver/pkg/apis/example/doc.go
+22
-0
fuzzer.go
staging/src/k8s.io/apiserver/pkg/apis/example/fuzzer.go
+98
-0
install.go
.../src/k8s.io/apiserver/pkg/apis/example/install/install.go
+44
-0
register.go
staging/src/k8s.io/apiserver/pkg/apis/example/register.go
+53
-0
types.go
staging/src/k8s.io/apiserver/pkg/apis/example/types.go
+134
-0
conversion.go
...ng/src/k8s.io/apiserver/pkg/apis/example/v1/conversion.go
+26
-0
defaults.go
staging/src/k8s.io/apiserver/pkg/apis/example/v1/defaults.go
+26
-0
doc.go
staging/src/k8s.io/apiserver/pkg/apis/example/v1/doc.go
+23
-0
generated.pb.go
.../src/k8s.io/apiserver/pkg/apis/example/v1/generated.pb.go
+34
-0
generated.proto
.../src/k8s.io/apiserver/pkg/apis/example/v1/generated.proto
+105
-0
register.go
staging/src/k8s.io/apiserver/pkg/apis/example/v1/register.go
+53
-0
types.generated.go
...c/k8s.io/apiserver/pkg/apis/example/v1/types.generated.go
+22
-0
types.go
staging/src/k8s.io/apiserver/pkg/apis/example/v1/types.go
+192
-0
types_swagger_doc_generated.go
...server/pkg/apis/example/v1/types_swagger_doc_generated.go
+17
-0
zz_generated.conversion.go
.../apiserver/pkg/apis/example/v1/zz_generated.conversion.go
+216
-0
zz_generated.deepcopy.go
...io/apiserver/pkg/apis/example/v1/zz_generated.deepcopy.go
+150
-0
zz_generated.defaults.go
...io/apiserver/pkg/apis/example/v1/zz_generated.defaults.go
+21
-0
zz_generated.deepcopy.go
...8s.io/apiserver/pkg/apis/example/zz_generated.deepcopy.go
+150
-0
No files found.
cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
View file @
161ca53f
...
...
@@ -67,6 +67,7 @@ func New() *Generator {
`+k8s.io/apimachinery/pkg/runtime/schema`
,
`+k8s.io/apimachinery/pkg/runtime`
,
`k8s.io/apimachinery/pkg/apis/meta/v1`
,
`k8s.io/apiserver/pkg/apis/example/v1`
,
`k8s.io/kubernetes/pkg/api/v1`
,
`k8s.io/kubernetes/pkg/apis/policy/v1beta1`
,
`k8s.io/kubernetes/pkg/apis/extensions/v1beta1`
,
...
...
pkg/api/testing/fuzzer.go
View file @
161ca53f
...
...
@@ -35,17 +35,19 @@ import (
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/apis/extensions"
extensionsv1beta1
"k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
)
// overrideGenericFuncs override some generic fuzzer funcs from k8s.io/apiserver in order to have more realistic
// values in a Kubernetes context.
func
overrideGenericFuncs
(
t
apitesting
.
TestingCommon
)
[]
interface
{}
{
func
overrideGenericFuncs
(
t
apitesting
.
TestingCommon
,
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
j
*
runtime
.
Object
,
c
fuzz
.
Continue
)
{
// TODO: uncomment when round trip starts from a versioned object
...
...
@@ -68,20 +70,12 @@ func overrideGenericFuncs(t apitesting.TestingCommon) []interface{} {
obj
:=
types
[
c
.
Rand
.
Intn
(
len
(
types
))]
c
.
Fuzz
(
obj
)
// Find a codec for converting the object to raw bytes. This is necessary for the
// api version and kind to be correctly set be serialization.
var
codec
runtime
.
Codec
switch
obj
.
(
type
)
{
case
*
api
.
Pod
:
codec
=
testapi
.
Default
.
Codec
()
case
*
extensions
.
Deployment
:
codec
=
testapi
.
Extensions
.
Codec
()
case
*
api
.
Service
:
codec
=
testapi
.
Default
.
Codec
()
codec
=
apitesting
.
TestCodec
(
codecs
,
extensionsv1beta1
.
SchemeGroupVersion
)
default
:
t
.
Errorf
(
"Failed to find codec for object type: %T"
,
obj
)
return
codec
=
apitesting
.
TestCodec
(
codecs
,
v1
.
SchemeGroupVersion
)
}
// Convert the object to raw bytes
...
...
@@ -604,9 +598,9 @@ func certificateFuncs(t apitesting.TestingCommon) []interface{} {
}
func
FuzzerFuncs
(
t
apitesting
.
TestingCommon
,
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
return
mergeFuncList
s
(
t
,
return
apitesting
.
MergeFuzzerFunc
s
(
t
,
apitesting
.
GenericFuzzerFuncs
(
t
,
codecs
),
overrideGenericFuncs
(
t
),
overrideGenericFuncs
(
t
,
codecs
),
coreFuncs
(
t
),
extensionFuncs
(
t
),
batchFuncs
(
t
),
...
...
@@ -623,25 +617,3 @@ func newBool(val bool) *bool {
*
p
=
val
return
p
}
// mergeFuncLists will merge the given funcLists, overriding early funcs with later ones if there first
// argument has the same type.
func
mergeFuncLists
(
t
apitesting
.
TestingCommon
,
funcLists
...
[]
interface
{})
[]
interface
{}
{
funcMap
:=
map
[
string
]
interface
{}{}
for
_
,
list
:=
range
funcLists
{
for
_
,
f
:=
range
list
{
fT
:=
reflect
.
TypeOf
(
f
)
if
fT
.
Kind
()
!=
reflect
.
Func
||
fT
.
NumIn
()
!=
2
{
t
.
Errorf
(
"Fuzzer func with invalid type: %v"
,
fT
)
continue
}
funcMap
[
fT
.
In
(
0
)
.
String
()]
=
f
}
}
result
:=
[]
interface
{}{}
for
_
,
f
:=
range
funcMap
{
result
=
append
(
result
,
f
)
}
return
result
}
staging/src/k8s.io/apimachinery/pkg/api/testing/fuzzer.go
View file @
161ca53f
...
...
@@ -17,20 +17,25 @@ limitations under the License.
package
testing
import
(
"strconv"
"math/rand"
"reflect"
"strconv"
"testing"
"github.com/google/gofuzz"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/api/resource"
)
func
GenericFuzzerFuncs
(
t
TestingCommon
,
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
q
*
resource
.
Quantity
,
c
fuzz
.
Continue
)
{
*
q
=
*
resource
.
NewQuantity
(
c
.
Int63n
(
1000
),
resource
.
DecimalExponent
)
},
func
(
j
*
int
,
c
fuzz
.
Continue
)
{
*
j
=
int
(
c
.
Int31
())
},
...
...
@@ -132,3 +137,25 @@ func FuzzerFor(funcs []interface{}, src rand.Source) *fuzz.Fuzzer {
f
.
Funcs
(
funcs
...
)
return
f
}
// MergeFuzzerFuncs will merge the given funcLists, overriding early funcs with later ones if there first
// argument has the same type.
func
MergeFuzzerFuncs
(
t
TestingCommon
,
funcLists
...
[]
interface
{})
[]
interface
{}
{
funcMap
:=
map
[
string
]
interface
{}{}
for
_
,
list
:=
range
funcLists
{
for
_
,
f
:=
range
list
{
fT
:=
reflect
.
TypeOf
(
f
)
if
fT
.
Kind
()
!=
reflect
.
Func
||
fT
.
NumIn
()
!=
2
{
t
.
Errorf
(
"Fuzzer func with invalid type: %v"
,
fT
)
continue
}
funcMap
[
fT
.
In
(
0
)
.
String
()]
=
f
}
}
result
:=
[]
interface
{}{}
for
_
,
f
:=
range
funcMap
{
result
=
append
(
result
,
f
)
}
return
result
}
staging/src/k8s.io/apiserver/pkg/apis/example/doc.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// +k8s:deepcopy-gen=package,register
// +groupName=example.k8s.io
//
// package example contains an example API used to demonstrate how to create api groups. Moreover, this is
// used within tests.
package
example
// import "k8s.io/apiserver/pkg/apis/example"
staging/src/k8s.io/apiserver/pkg/apis/example/fuzzer.go
0 → 100644
View file @
161ca53f
/*
Copyright 2015 The Kubernetes Authors.
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
example
import
(
"github.com/google/gofuzz"
apitesting
"k8s.io/apimachinery/pkg/api/testing"
"k8s.io/apimachinery/pkg/runtime"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
examplev1
"k8s.io/apiserver/pkg/apis/example/v1"
)
// overrideGenericFuncs override some generic fuzzer funcs from k8s.io/apiserver in order to have more realistic
// values in a Kubernetes context.
func
overrideGenericFuncs
(
t
apitesting
.
TestingCommon
,
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
j
*
runtime
.
Object
,
c
fuzz
.
Continue
)
{
// TODO: uncomment when round trip starts from a versioned object
if
true
{
//c.RandBool() {
*
j
=
&
runtime
.
Unknown
{
// We do not set TypeMeta here because it is not carried through a round trip
Raw
:
[]
byte
(
`{"apiVersion":"unknown.group/unknown","kind":"Something","someKey":"someValue"}`
),
ContentType
:
runtime
.
ContentTypeJSON
,
}
}
else
{
types
:=
[]
runtime
.
Object
{
&
Pod
{}}
t
:=
types
[
c
.
Rand
.
Intn
(
len
(
types
))]
c
.
Fuzz
(
t
)
*
j
=
t
}
},
func
(
r
*
runtime
.
RawExtension
,
c
fuzz
.
Continue
)
{
// Pick an arbitrary type and fuzz it
types
:=
[]
runtime
.
Object
{
&
Pod
{}}
obj
:=
types
[
c
.
Rand
.
Intn
(
len
(
types
))]
c
.
Fuzz
(
obj
)
// Convert the object to raw bytes
bytes
,
err
:=
runtime
.
Encode
(
apitesting
.
TestCodec
(
codecs
,
examplev1
.
SchemeGroupVersion
),
obj
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to encode object: %v"
,
err
)
return
}
// Set the bytes field on the RawExtension
r
.
Raw
=
bytes
},
}
}
func
exampleFuncs
(
t
apitesting
.
TestingCommon
)
[]
interface
{}
{
return
[]
interface
{}{
func
(
s
*
PodSpec
,
c
fuzz
.
Continue
)
{
c
.
FuzzNoCustom
(
s
)
// has a default value
ttl
:=
int64
(
30
)
if
c
.
RandBool
()
{
ttl
=
int64
(
c
.
Uint32
())
}
s
.
TerminationGracePeriodSeconds
=
&
ttl
if
s
.
SchedulerName
==
""
{
s
.
SchedulerName
=
"default-scheduler"
}
},
func
(
j
*
PodPhase
,
c
fuzz
.
Continue
)
{
statuses
:=
[]
PodPhase
{
"Pending"
,
"Running"
,
"Succeeded"
,
"Failed"
,
"Unknown"
}
*
j
=
statuses
[
c
.
Rand
.
Intn
(
len
(
statuses
))]
},
func
(
rp
*
RestartPolicy
,
c
fuzz
.
Continue
)
{
policies
:=
[]
RestartPolicy
{
"Always"
,
"Never"
,
"OnFailure"
}
*
rp
=
policies
[
c
.
Rand
.
Intn
(
len
(
policies
))]
},
}
}
func
FuzzerFuncs
(
t
apitesting
.
TestingCommon
,
codecs
runtimeserializer
.
CodecFactory
)
[]
interface
{}
{
return
apitesting
.
MergeFuzzerFuncs
(
t
,
apitesting
.
GenericFuzzerFuncs
(
t
,
codecs
),
overrideGenericFuncs
(
t
,
codecs
),
exampleFuncs
(
t
),
)
}
staging/src/k8s.io/apiserver/pkg/apis/example/install/install.go
0 → 100644
View file @
161ca53f
/*
Copyright 2016 The Kubernetes Authors.
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 install installs the certificates API group, making it available as
// an option to all of the API encoding/decoding machinery.
package
install
import
(
"k8s.io/apimachinery/pkg/apimachinery/announced"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/apis/example"
examplev1
"k8s.io/apiserver/pkg/apis/example/v1"
)
// Install registers the API group and adds types to a scheme
func
Install
(
groupFactoryRegistry
announced
.
APIGroupFactoryRegistry
,
registry
*
registered
.
APIRegistrationManager
,
scheme
*
runtime
.
Scheme
)
{
if
err
:=
announced
.
NewGroupMetaFactory
(
&
announced
.
GroupMetaFactoryArgs
{
GroupName
:
example
.
GroupName
,
VersionPreferenceOrder
:
[]
string
{
examplev1
.
SchemeGroupVersion
.
Version
},
ImportPrefix
:
"k8s.io/apiserver/pkg/apis/example"
,
AddInternalObjectsToScheme
:
example
.
AddToScheme
,
},
announced
.
VersionToSchemeFunc
{
examplev1
.
SchemeGroupVersion
.
Version
:
examplev1
.
AddToScheme
,
},
)
.
Announce
(
groupFactoryRegistry
)
.
RegisterAndEnable
(
registry
,
scheme
);
err
!=
nil
{
panic
(
err
)
}
}
staging/src/k8s.io/apiserver/pkg/apis/example/register.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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
example
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var
(
SchemeBuilder
=
runtime
.
NewSchemeBuilder
(
addKnownTypes
)
AddToScheme
=
SchemeBuilder
.
AddToScheme
)
// GroupName is the group name use in this package
const
GroupName
=
"example.apiserver.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
runtime
.
APIVersionInternal
}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func
Kind
(
kind
string
)
schema
.
GroupKind
{
return
SchemeGroupVersion
.
WithKind
(
kind
)
.
GroupKind
()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func
Resource
(
resource
string
)
schema
.
GroupResource
{
return
SchemeGroupVersion
.
WithResource
(
resource
)
.
GroupResource
()
}
// Adds the list of known types to api.Scheme.
func
addKnownTypes
(
scheme
*
runtime
.
Scheme
)
error
{
scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
&
Pod
{},
)
metav1
.
AddToGroupVersion
(
scheme
,
SchemeGroupVersion
)
return
nil
}
staging/src/k8s.io/apiserver/pkg/apis/example/types.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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
example
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
)
type
(
ConditionStatus
string
PodConditionType
string
PodPhase
string
RestartPolicy
string
)
// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
type
Pod
struct
{
metav1
.
TypeMeta
// +optional
metav1
.
ObjectMeta
// Spec defines the behavior of a pod.
// +optional
Spec
PodSpec
// Status represents the current information about a pod. This data may not be up
// to date.
// +optional
Status
PodStatus
}
// PodStatus represents information about the status of a pod. Status may trail the actual
// state of a system.
type
PodStatus
struct
{
// +optional
Phase
PodPhase
// +optional
Conditions
[]
PodCondition
// A human readable message indicating details about why the pod is in this state.
// +optional
Message
string
// A brief CamelCase message indicating details about why the pod is in this state. e.g. 'OutOfDisk'
// +optional
Reason
string
// +optional
HostIP
string
// +optional
PodIP
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.
// +optional
StartTime
*
metav1
.
Time
}
type
PodCondition
struct
{
Type
PodConditionType
Status
ConditionStatus
// +optional
LastProbeTime
metav1
.
Time
// +optional
LastTransitionTime
metav1
.
Time
// +optional
Reason
string
// +optional
Message
string
}
// PodSpec is a description of a pod
type
PodSpec
struct
{
// +optional
RestartPolicy
RestartPolicy
// Optional duration in seconds the pod 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
// 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
ActiveDeadlineSeconds
*
int64
// NodeSelector is a selector which must be true for the pod 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
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
// requirements.
// +optional
NodeName
string
// Specifies the hostname of the Pod.
// If not specified, the pod's hostname will be set to a system-defined value.
// +optional
Hostname
string
// If specified, the fully qualified Pod hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>".
// If not specified, the pod 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.
// +optional
SchedulerName
string
}
// PodList is a list of Pods.
type
PodList
struct
{
metav1
.
TypeMeta
// +optional
metav1
.
ListMeta
Items
[]
Pod
}
staging/src/k8s.io/apiserver/pkg/apis/example/v1/conversion.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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
v1
import
(
"k8s.io/apimachinery/pkg/runtime"
)
func
addConversionFuncs
(
scheme
*
runtime
.
Scheme
)
error
{
// Add non-generated conversion functions here. Currently there are none.
return
nil
}
staging/src/k8s.io/apiserver/pkg/apis/example/v1/defaults.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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
v1
import
(
"k8s.io/apimachinery/pkg/runtime"
)
func
addDefaultingFuncs
(
scheme
*
runtime
.
Scheme
)
error
{
return
nil
}
staging/src/k8s.io/apiserver/pkg/apis/example/v1/doc.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/apis/example
// +k8s:openapi-gen=false
// +k8s:defaulter-gen=TypeMeta
// +groupName=example.apiserver.k8s.io
package
v1
// import "k8s.io/apiserver/pkg/apis/example/v1"
staging/src/k8s.io/apiserver/pkg/apis/example/v1/generated.pb.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// Code generated by protoc-gen-gogo.
// source: k8s.io/kubernetes/pkg/apis/certificates/v1beta1/generated.proto
// DO NOT EDIT!
/*
Package v1beta1 is a generated protocol buffer package.
It is generated from these files:
k8s.io/kubernetes/pkg/apis/certificates/v1beta1/generated.proto
It has these top-level messages:
CertificateSigningRequest
CertificateSigningRequestCondition
CertificateSigningRequestList
CertificateSigningRequestSpec
CertificateSigningRequestStatus
*/
package
v1
staging/src/k8s.io/apiserver/pkg/apis/example/v1/generated.proto
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax
=
'proto2'
;
package
k8s
.
io.kubernetes.pkg.apis.certificates.v1beta1
;
import
"k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"
;
import
"k8s.io/apimachinery/pkg/runtime/generated.proto"
;
import
"k8s.io/apimachinery/pkg/runtime/schema/generated.proto"
;
import
"k8s.io/apimachinery/pkg/util/intstr/generated.proto"
;
import
"k8s.io/kubernetes/pkg/api/v1/generated.proto"
;
// Package-wide variables from generator "generated".
option
go_package
=
"v1beta1"
;
// Describes a certificate signing request
message
CertificateSigningRequest
{
// +optional
optional
k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta
metadata
=
1
;
// The certificate request itself and any additional information.
// +optional
optional
CertificateSigningRequestSpec
spec
=
2
;
// Derived information about the request.
// +optional
optional
CertificateSigningRequestStatus
status
=
3
;
}
message
CertificateSigningRequestCondition
{
// request approval state, currently Approved or Denied.
optional
string
type
=
1
;
// brief reason for the request state
// +optional
optional
string
reason
=
2
;
// human readable message with details about the request state
// +optional
optional
string
message
=
3
;
// timestamp for the last update to this condition
// +optional
optional
k8s.io.apimachinery.pkg.apis.meta.v1.Time
lastUpdateTime
=
4
;
}
message
CertificateSigningRequestList
{
// +optional
optional
k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta
metadata
=
1
;
repeated
CertificateSigningRequest
items
=
2
;
}
// This information is immutable after the request is created. Only the Request
// and ExtraInfo fields can be set on creation, other fields are derived by
// Kubernetes and cannot be modified by users.
message
CertificateSigningRequestSpec
{
// Base64-encoded PKCS#10 CSR data
optional
bytes
request
=
1
;
// allowedUsages specifies a set of usage contexts the key will be
// valid for.
// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
// https://tools.ietf.org/html/rfc5280#section-4.2.1.12
repeated
string
keyUsage
=
5
;
// Information about the requesting user (if relevant)
// See user.Info interface for details
// +optional
optional
string
username
=
2
;
// +optional
optional
string
uid
=
3
;
// +optional
repeated
string
groups
=
4
;
}
message
CertificateSigningRequestStatus
{
// Conditions applied to the request, such as approval or denial.
// +optional
repeated
CertificateSigningRequestCondition
conditions
=
1
;
// If request was approved, the controller will place the issued certificate here.
// +optional
optional
bytes
certificate
=
2
;
}
staging/src/k8s.io/apiserver/pkg/apis/example/v1/register.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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
v1
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the group name use in this package
const
GroupName
=
"example.apiserver.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var
SchemeGroupVersion
=
schema
.
GroupVersion
{
Group
:
GroupName
,
Version
:
"v1"
}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func
Kind
(
kind
string
)
schema
.
GroupKind
{
return
SchemeGroupVersion
.
WithKind
(
kind
)
.
GroupKind
()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func
Resource
(
resource
string
)
schema
.
GroupResource
{
return
SchemeGroupVersion
.
WithResource
(
resource
)
.
GroupResource
()
}
var
(
SchemeBuilder
=
runtime
.
NewSchemeBuilder
(
addKnownTypes
,
addConversionFuncs
,
addDefaultingFuncs
)
AddToScheme
=
SchemeBuilder
.
AddToScheme
)
// Adds the list of known types to api.Scheme.
func
addKnownTypes
(
scheme
*
runtime
.
Scheme
)
error
{
scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
&
Pod
{},
)
metav1
.
AddToGroupVersion
(
scheme
,
SchemeGroupVersion
)
return
nil
}
staging/src/k8s.io/apiserver/pkg/apis/example/v1/types.generated.go
0 → 100644
View file @
161ca53f
/*
Copyright 2016 The Kubernetes Authors.
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.
*/
// ************************************************************
// DO NOT EDIT.
// THIS FILE IS AUTO-GENERATED BY codecgen.
// ************************************************************
package
v1
staging/src/k8s.io/apiserver/pkg/apis/example/v1/types.go
0 → 100644
View file @
161ca53f
/*
Copyright 2017 The Kubernetes Authors.
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
v1
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
)
type
(
ConditionStatus
string
PodConditionType
string
PodPhase
string
RestartPolicy
string
)
// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
type
Pod
struct
{
metav1
.
TypeMeta
`json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional
metav1
.
ObjectMeta
`json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the desired behavior of the pod.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional
Spec
PodSpec
`json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Most recently observed status of the pod.
// This data may not be up to date.
// Populated by the system.
// Read-only.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional
Status
PodStatus
`json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// PodStatus represents information about the status of a pod. Status may trail the actual
// state of a system.
type
PodStatus
struct
{
// Current condition of the pod.
// More info: http://kubernetes.io/docs/user-guide/pod-states#pod-phase
// +optional
Phase
PodPhase
`json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=PodPhase"`
// Current service state of pod.
// More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions
// +optional
Conditions
[]
PodCondition
`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.
// +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.
// 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.
// +optional
HostIP
string
`json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"`
// IP address allocated to the pod. Routable at least within the cluster.
// Empty if not yet allocated.
// +optional
PodIP
string
`json:"podIP,omitempty" protobuf:"bytes,6,opt,name=podIP"`
// 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.
// +optional
StartTime
*
metav1
.
Time
`json:"startTime,omitempty" protobuf:"bytes,7,opt,name=startTime"`
}
type
PodCondition
struct
{
// Type is the type of the condition.
// Currently only Ready.
// More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions
Type
PodConditionType
`json:"type" protobuf:"bytes,1,opt,name=type,casttype=PodConditionType"`
// Status is the status of the condition.
// Can be True, False, Unknown.
// More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions
Status
ConditionStatus
`json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
// Last time we probed the condition.
// +optional
LastProbeTime
metav1
.
Time
`json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"`
// Last time the condition transitioned from one status to another.
// +optional
LastTransitionTime
metav1
.
Time
`json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
// Unique, one-word, CamelCase reason for the condition's last transition.
// +optional
Reason
string
`json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"`
// Human-readable message indicating details about last transition.
// +optional
Message
string
`json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
}
// PodSpec is a description of a pod
type
PodSpec
struct
{
// Restart policy for all containers within the pod.
// One of Always, OnFailure, Never.
// Default to Always.
// More info: http://kubernetes.io/docs/user-guide/pod-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.
// 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
// 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
// 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.
// 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.
// More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md
// +optional
ServiceAccountName
string
`json:"serviceAccountName,omitempty" protobuf:"bytes,8,opt,name=serviceAccountName"`
// DeprecatedServiceAccount is a depreciated alias for ServiceAccountName.
// Deprecated: Use serviceAccountName instead.
// +k8s:conversion-gen=false
// +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
// 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.
// If this option is set, the ports that will be used must be specified.
// Default to false.
// +k8s:conversion-gen=false
// +optional
HostNetwork
bool
`json:"hostNetwork,omitempty" protobuf:"varint,11,opt,name=hostNetwork"`
// Use the host's pid namespace.
// Optional: Default to false.
// +k8s:conversion-gen=false
// +optional
HostPID
bool
`json:"hostPID,omitempty" protobuf:"varint,12,opt,name=hostPID"`
// Use the host's ipc namespace.
// Optional: Default to false.
// +k8s:conversion-gen=false
// +optional
HostIPC
bool
`json:"hostIPC,omitempty" protobuf:"varint,13,opt,name=hostIPC"`
// Specifies the hostname of the Pod
// If not specified, the pod'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 Pod hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>".
// If not specified, the pod 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.
// +optional
SchedulerName
string
`json:"schedulername,omitempty" protobuf:"bytes,19,opt,name=schedulername"`
}
// PodList is a list of Pods.
type
PodList
struct
{
metav1
.
TypeMeta
`json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
// +optional
metav1
.
ListMeta
`json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of pods.
// More info: http://kubernetes.io/docs/user-guide/pods
Items
[]
Pod
`json:"items" protobuf:"bytes,2,rep,name=items"`
}
staging/src/k8s.io/apiserver/pkg/apis/example/v1/types_swagger_doc_generated.go
0 → 100644
View file @
161ca53f
/*
Copyright 2016 The Kubernetes Authors.
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
v1
staging/src/k8s.io/apiserver/pkg/apis/example/v1/zz_generated.conversion.go
0 → 100644
View file @
161ca53f
// +build !ignore_autogenerated
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// This file was autogenerated by conversion-gen. Do not edit it manually!
package
v1
import
(
meta_v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
conversion
"k8s.io/apimachinery/pkg/conversion"
runtime
"k8s.io/apimachinery/pkg/runtime"
example
"k8s.io/apiserver/pkg/apis/example"
unsafe
"unsafe"
)
func
init
()
{
SchemeBuilder
.
Register
(
RegisterConversions
)
}
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func
RegisterConversions
(
scheme
*
runtime
.
Scheme
)
error
{
return
scheme
.
AddGeneratedConversionFuncs
(
Convert_v1_Pod_To_example_Pod
,
Convert_example_Pod_To_v1_Pod
,
Convert_v1_PodCondition_To_example_PodCondition
,
Convert_example_PodCondition_To_v1_PodCondition
,
Convert_v1_PodList_To_example_PodList
,
Convert_example_PodList_To_v1_PodList
,
Convert_v1_PodSpec_To_example_PodSpec
,
Convert_example_PodSpec_To_v1_PodSpec
,
Convert_v1_PodStatus_To_example_PodStatus
,
Convert_example_PodStatus_To_v1_PodStatus
,
)
}
func
autoConvert_v1_Pod_To_example_Pod
(
in
*
Pod
,
out
*
example
.
Pod
,
s
conversion
.
Scope
)
error
{
out
.
ObjectMeta
=
in
.
ObjectMeta
if
err
:=
Convert_v1_PodSpec_To_example_PodSpec
(
&
in
.
Spec
,
&
out
.
Spec
,
s
);
err
!=
nil
{
return
err
}
if
err
:=
Convert_v1_PodStatus_To_example_PodStatus
(
&
in
.
Status
,
&
out
.
Status
,
s
);
err
!=
nil
{
return
err
}
return
nil
}
func
Convert_v1_Pod_To_example_Pod
(
in
*
Pod
,
out
*
example
.
Pod
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_Pod_To_example_Pod
(
in
,
out
,
s
)
}
func
autoConvert_example_Pod_To_v1_Pod
(
in
*
example
.
Pod
,
out
*
Pod
,
s
conversion
.
Scope
)
error
{
out
.
ObjectMeta
=
in
.
ObjectMeta
if
err
:=
Convert_example_PodSpec_To_v1_PodSpec
(
&
in
.
Spec
,
&
out
.
Spec
,
s
);
err
!=
nil
{
return
err
}
if
err
:=
Convert_example_PodStatus_To_v1_PodStatus
(
&
in
.
Status
,
&
out
.
Status
,
s
);
err
!=
nil
{
return
err
}
return
nil
}
func
Convert_example_Pod_To_v1_Pod
(
in
*
example
.
Pod
,
out
*
Pod
,
s
conversion
.
Scope
)
error
{
return
autoConvert_example_Pod_To_v1_Pod
(
in
,
out
,
s
)
}
func
autoConvert_v1_PodCondition_To_example_PodCondition
(
in
*
PodCondition
,
out
*
example
.
PodCondition
,
s
conversion
.
Scope
)
error
{
out
.
Type
=
example
.
PodConditionType
(
in
.
Type
)
out
.
Status
=
example
.
ConditionStatus
(
in
.
Status
)
out
.
LastProbeTime
=
in
.
LastProbeTime
out
.
LastTransitionTime
=
in
.
LastTransitionTime
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
return
nil
}
func
Convert_v1_PodCondition_To_example_PodCondition
(
in
*
PodCondition
,
out
*
example
.
PodCondition
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_PodCondition_To_example_PodCondition
(
in
,
out
,
s
)
}
func
autoConvert_example_PodCondition_To_v1_PodCondition
(
in
*
example
.
PodCondition
,
out
*
PodCondition
,
s
conversion
.
Scope
)
error
{
out
.
Type
=
PodConditionType
(
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
}
func
Convert_example_PodCondition_To_v1_PodCondition
(
in
*
example
.
PodCondition
,
out
*
PodCondition
,
s
conversion
.
Scope
)
error
{
return
autoConvert_example_PodCondition_To_v1_PodCondition
(
in
,
out
,
s
)
}
func
autoConvert_v1_PodList_To_example_PodList
(
in
*
PodList
,
out
*
example
.
PodList
,
s
conversion
.
Scope
)
error
{
out
.
ListMeta
=
in
.
ListMeta
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
example
.
Pod
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
err
:=
Convert_v1_Pod_To_example_Pod
(
&
(
*
in
)[
i
],
&
(
*
out
)[
i
],
s
);
err
!=
nil
{
return
err
}
}
}
else
{
out
.
Items
=
nil
}
return
nil
}
func
Convert_v1_PodList_To_example_PodList
(
in
*
PodList
,
out
*
example
.
PodList
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_PodList_To_example_PodList
(
in
,
out
,
s
)
}
func
autoConvert_example_PodList_To_v1_PodList
(
in
*
example
.
PodList
,
out
*
PodList
,
s
conversion
.
Scope
)
error
{
out
.
ListMeta
=
in
.
ListMeta
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
Pod
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
err
:=
Convert_example_Pod_To_v1_Pod
(
&
(
*
in
)[
i
],
&
(
*
out
)[
i
],
s
);
err
!=
nil
{
return
err
}
}
}
else
{
out
.
Items
=
nil
}
return
nil
}
func
Convert_example_PodList_To_v1_PodList
(
in
*
example
.
PodList
,
out
*
PodList
,
s
conversion
.
Scope
)
error
{
return
autoConvert_example_PodList_To_v1_PodList
(
in
,
out
,
s
)
}
func
autoConvert_v1_PodSpec_To_example_PodSpec
(
in
*
PodSpec
,
out
*
example
.
PodSpec
,
s
conversion
.
Scope
)
error
{
out
.
RestartPolicy
=
example
.
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
}
func
Convert_v1_PodSpec_To_example_PodSpec
(
in
*
PodSpec
,
out
*
example
.
PodSpec
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_PodSpec_To_example_PodSpec
(
in
,
out
,
s
)
}
func
autoConvert_example_PodSpec_To_v1_PodSpec
(
in
*
example
.
PodSpec
,
out
*
PodSpec
,
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
}
func
Convert_example_PodSpec_To_v1_PodSpec
(
in
*
example
.
PodSpec
,
out
*
PodSpec
,
s
conversion
.
Scope
)
error
{
return
autoConvert_example_PodSpec_To_v1_PodSpec
(
in
,
out
,
s
)
}
func
autoConvert_v1_PodStatus_To_example_PodStatus
(
in
*
PodStatus
,
out
*
example
.
PodStatus
,
s
conversion
.
Scope
)
error
{
out
.
Phase
=
example
.
PodPhase
(
in
.
Phase
)
out
.
Conditions
=
*
(
*
[]
example
.
PodCondition
)(
unsafe
.
Pointer
(
&
in
.
Conditions
))
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
StartTime
=
(
*
meta_v1
.
Time
)(
unsafe
.
Pointer
(
in
.
StartTime
))
return
nil
}
func
Convert_v1_PodStatus_To_example_PodStatus
(
in
*
PodStatus
,
out
*
example
.
PodStatus
,
s
conversion
.
Scope
)
error
{
return
autoConvert_v1_PodStatus_To_example_PodStatus
(
in
,
out
,
s
)
}
func
autoConvert_example_PodStatus_To_v1_PodStatus
(
in
*
example
.
PodStatus
,
out
*
PodStatus
,
s
conversion
.
Scope
)
error
{
out
.
Phase
=
PodPhase
(
in
.
Phase
)
out
.
Conditions
=
*
(
*
[]
PodCondition
)(
unsafe
.
Pointer
(
&
in
.
Conditions
))
out
.
Message
=
in
.
Message
out
.
Reason
=
in
.
Reason
out
.
HostIP
=
in
.
HostIP
out
.
PodIP
=
in
.
PodIP
out
.
StartTime
=
(
*
meta_v1
.
Time
)(
unsafe
.
Pointer
(
in
.
StartTime
))
return
nil
}
func
Convert_example_PodStatus_To_v1_PodStatus
(
in
*
example
.
PodStatus
,
out
*
PodStatus
,
s
conversion
.
Scope
)
error
{
return
autoConvert_example_PodStatus_To_v1_PodStatus
(
in
,
out
,
s
)
}
staging/src/k8s.io/apiserver/pkg/apis/example/v1/zz_generated.deepcopy.go
0 → 100644
View file @
161ca53f
// +build !ignore_autogenerated
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package
v1
import
(
meta_v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
conversion
"k8s.io/apimachinery/pkg/conversion"
runtime
"k8s.io/apimachinery/pkg/runtime"
reflect
"reflect"
)
func
init
()
{
SchemeBuilder
.
Register
(
RegisterDeepCopies
)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
func
RegisterDeepCopies
(
scheme
*
runtime
.
Scheme
)
error
{
return
scheme
.
AddGeneratedDeepCopyFuncs
(
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_v1_Pod
,
InType
:
reflect
.
TypeOf
(
&
Pod
{})},
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_v1_PodCondition
,
InType
:
reflect
.
TypeOf
(
&
PodCondition
{})},
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_v1_PodList
,
InType
:
reflect
.
TypeOf
(
&
PodList
{})},
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_v1_PodSpec
,
InType
:
reflect
.
TypeOf
(
&
PodSpec
{})},
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_v1_PodStatus
,
InType
:
reflect
.
TypeOf
(
&
PodStatus
{})},
)
}
func
DeepCopy_v1_Pod
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
Pod
)
out
:=
out
.
(
*
Pod
)
*
out
=
*
in
if
newVal
,
err
:=
c
.
DeepCopy
(
&
in
.
ObjectMeta
);
err
!=
nil
{
return
err
}
else
{
out
.
ObjectMeta
=
*
newVal
.
(
*
meta_v1
.
ObjectMeta
)
}
if
newVal
,
err
:=
c
.
DeepCopy
(
&
in
.
Spec
);
err
!=
nil
{
return
err
}
else
{
out
.
Spec
=
*
newVal
.
(
*
PodSpec
)
}
if
newVal
,
err
:=
c
.
DeepCopy
(
&
in
.
Status
);
err
!=
nil
{
return
err
}
else
{
out
.
Status
=
*
newVal
.
(
*
PodStatus
)
}
return
nil
}
}
func
DeepCopy_v1_PodCondition
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
PodCondition
)
out
:=
out
.
(
*
PodCondition
)
*
out
=
*
in
out
.
LastProbeTime
=
in
.
LastProbeTime
.
DeepCopy
()
out
.
LastTransitionTime
=
in
.
LastTransitionTime
.
DeepCopy
()
return
nil
}
}
func
DeepCopy_v1_PodList
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
PodList
)
out
:=
out
.
(
*
PodList
)
*
out
=
*
in
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
Pod
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
newVal
,
err
:=
c
.
DeepCopy
(
&
(
*
in
)[
i
]);
err
!=
nil
{
return
err
}
else
{
(
*
out
)[
i
]
=
*
newVal
.
(
*
Pod
)
}
}
}
return
nil
}
}
func
DeepCopy_v1_PodSpec
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
PodSpec
)
out
:=
out
.
(
*
PodSpec
)
*
out
=
*
in
if
in
.
TerminationGracePeriodSeconds
!=
nil
{
in
,
out
:=
&
in
.
TerminationGracePeriodSeconds
,
&
out
.
TerminationGracePeriodSeconds
*
out
=
new
(
int64
)
**
out
=
**
in
}
if
in
.
ActiveDeadlineSeconds
!=
nil
{
in
,
out
:=
&
in
.
ActiveDeadlineSeconds
,
&
out
.
ActiveDeadlineSeconds
*
out
=
new
(
int64
)
**
out
=
**
in
}
if
in
.
NodeSelector
!=
nil
{
in
,
out
:=
&
in
.
NodeSelector
,
&
out
.
NodeSelector
*
out
=
make
(
map
[
string
]
string
)
for
key
,
val
:=
range
*
in
{
(
*
out
)[
key
]
=
val
}
}
return
nil
}
}
func
DeepCopy_v1_PodStatus
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
PodStatus
)
out
:=
out
.
(
*
PodStatus
)
*
out
=
*
in
if
in
.
Conditions
!=
nil
{
in
,
out
:=
&
in
.
Conditions
,
&
out
.
Conditions
*
out
=
make
([]
PodCondition
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
newVal
,
err
:=
c
.
DeepCopy
(
&
(
*
in
)[
i
]);
err
!=
nil
{
return
err
}
else
{
(
*
out
)[
i
]
=
*
newVal
.
(
*
PodCondition
)
}
}
}
if
in
.
StartTime
!=
nil
{
in
,
out
:=
&
in
.
StartTime
,
&
out
.
StartTime
*
out
=
new
(
meta_v1
.
Time
)
**
out
=
(
*
in
)
.
DeepCopy
()
}
return
nil
}
}
staging/src/k8s.io/apiserver/pkg/apis/example/v1/zz_generated.defaults.go
0 → 100644
View file @
161ca53f
// +build !ignore_autogenerated
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// This file was autogenerated by defaulter-gen. Do not edit it manually!
package
v1
staging/src/k8s.io/apiserver/pkg/apis/example/zz_generated.deepcopy.go
0 → 100644
View file @
161ca53f
// +build !ignore_autogenerated
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package
example
import
(
v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
conversion
"k8s.io/apimachinery/pkg/conversion"
runtime
"k8s.io/apimachinery/pkg/runtime"
reflect
"reflect"
)
func
init
()
{
SchemeBuilder
.
Register
(
RegisterDeepCopies
)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
func
RegisterDeepCopies
(
scheme
*
runtime
.
Scheme
)
error
{
return
scheme
.
AddGeneratedDeepCopyFuncs
(
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_example_Pod
,
InType
:
reflect
.
TypeOf
(
&
Pod
{})},
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_example_PodCondition
,
InType
:
reflect
.
TypeOf
(
&
PodCondition
{})},
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_example_PodList
,
InType
:
reflect
.
TypeOf
(
&
PodList
{})},
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_example_PodSpec
,
InType
:
reflect
.
TypeOf
(
&
PodSpec
{})},
conversion
.
GeneratedDeepCopyFunc
{
Fn
:
DeepCopy_example_PodStatus
,
InType
:
reflect
.
TypeOf
(
&
PodStatus
{})},
)
}
func
DeepCopy_example_Pod
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
Pod
)
out
:=
out
.
(
*
Pod
)
*
out
=
*
in
if
newVal
,
err
:=
c
.
DeepCopy
(
&
in
.
ObjectMeta
);
err
!=
nil
{
return
err
}
else
{
out
.
ObjectMeta
=
*
newVal
.
(
*
v1
.
ObjectMeta
)
}
if
newVal
,
err
:=
c
.
DeepCopy
(
&
in
.
Spec
);
err
!=
nil
{
return
err
}
else
{
out
.
Spec
=
*
newVal
.
(
*
PodSpec
)
}
if
newVal
,
err
:=
c
.
DeepCopy
(
&
in
.
Status
);
err
!=
nil
{
return
err
}
else
{
out
.
Status
=
*
newVal
.
(
*
PodStatus
)
}
return
nil
}
}
func
DeepCopy_example_PodCondition
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
PodCondition
)
out
:=
out
.
(
*
PodCondition
)
*
out
=
*
in
out
.
LastProbeTime
=
in
.
LastProbeTime
.
DeepCopy
()
out
.
LastTransitionTime
=
in
.
LastTransitionTime
.
DeepCopy
()
return
nil
}
}
func
DeepCopy_example_PodList
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
PodList
)
out
:=
out
.
(
*
PodList
)
*
out
=
*
in
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
Pod
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
newVal
,
err
:=
c
.
DeepCopy
(
&
(
*
in
)[
i
]);
err
!=
nil
{
return
err
}
else
{
(
*
out
)[
i
]
=
*
newVal
.
(
*
Pod
)
}
}
}
return
nil
}
}
func
DeepCopy_example_PodSpec
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
PodSpec
)
out
:=
out
.
(
*
PodSpec
)
*
out
=
*
in
if
in
.
TerminationGracePeriodSeconds
!=
nil
{
in
,
out
:=
&
in
.
TerminationGracePeriodSeconds
,
&
out
.
TerminationGracePeriodSeconds
*
out
=
new
(
int64
)
**
out
=
**
in
}
if
in
.
ActiveDeadlineSeconds
!=
nil
{
in
,
out
:=
&
in
.
ActiveDeadlineSeconds
,
&
out
.
ActiveDeadlineSeconds
*
out
=
new
(
int64
)
**
out
=
**
in
}
if
in
.
NodeSelector
!=
nil
{
in
,
out
:=
&
in
.
NodeSelector
,
&
out
.
NodeSelector
*
out
=
make
(
map
[
string
]
string
)
for
key
,
val
:=
range
*
in
{
(
*
out
)[
key
]
=
val
}
}
return
nil
}
}
func
DeepCopy_example_PodStatus
(
in
interface
{},
out
interface
{},
c
*
conversion
.
Cloner
)
error
{
{
in
:=
in
.
(
*
PodStatus
)
out
:=
out
.
(
*
PodStatus
)
*
out
=
*
in
if
in
.
Conditions
!=
nil
{
in
,
out
:=
&
in
.
Conditions
,
&
out
.
Conditions
*
out
=
make
([]
PodCondition
,
len
(
*
in
))
for
i
:=
range
*
in
{
if
newVal
,
err
:=
c
.
DeepCopy
(
&
(
*
in
)[
i
]);
err
!=
nil
{
return
err
}
else
{
(
*
out
)[
i
]
=
*
newVal
.
(
*
PodCondition
)
}
}
}
if
in
.
StartTime
!=
nil
{
in
,
out
:=
&
in
.
StartTime
,
&
out
.
StartTime
*
out
=
new
(
v1
.
Time
)
**
out
=
(
*
in
)
.
DeepCopy
()
}
return
nil
}
}
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