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
db5a851d
Unverified
Commit
db5a851d
authored
Apr 28, 2016
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inline default methods by hand in custom conversions
parent
7104be87
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
89 deletions
+1
-89
conversion.go
pkg/api/v1/conversion.go
+1
-24
conversion.go
pkg/apis/apps/v1alpha1/conversion.go
+0
-7
conversion.go
pkg/apis/autoscaling/v1/conversion.go
+0
-14
conversion.go
pkg/apis/batch/v1/conversion.go
+0
-7
conversion.go
pkg/apis/extensions/v1beta1/conversion.go
+0
-37
No files found.
pkg/api/v1/conversion.go
View file @
db5a851d
...
...
@@ -18,7 +18,6 @@ package v1
import
(
"fmt"
"reflect"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/conversion"
...
...
@@ -200,9 +199,6 @@ func addConversionFuncs(scheme *runtime.Scheme) {
}
func
Convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec
(
in
*
api
.
ReplicationControllerSpec
,
out
*
ReplicationControllerSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
api
.
ReplicationControllerSpec
))(
in
)
}
out
.
Replicas
=
new
(
int32
)
*
out
.
Replicas
=
int32
(
in
.
Replicas
)
if
in
.
Selector
!=
nil
{
...
...
@@ -233,9 +229,6 @@ func Convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *a
}
func
Convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec
(
in
*
ReplicationControllerSpec
,
out
*
api
.
ReplicationControllerSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
ReplicationControllerSpec
))(
in
)
}
out
.
Replicas
=
*
in
.
Replicas
if
in
.
Selector
!=
nil
{
out
.
Selector
=
make
(
map
[
string
]
string
)
...
...
@@ -267,9 +260,6 @@ func Convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *R
// The following two PodSpec conversions are done here to support ServiceAccount
// as an alias for ServiceAccountName.
func
Convert_api_PodSpec_To_v1_PodSpec
(
in
*
api
.
PodSpec
,
out
*
PodSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
api
.
PodSpec
))(
in
)
}
if
in
.
Volumes
!=
nil
{
out
.
Volumes
=
make
([]
Volume
,
len
(
in
.
Volumes
))
for
i
:=
range
in
.
Volumes
{
...
...
@@ -344,9 +334,7 @@ func Convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversi
}
func
Convert_v1_PodSpec_To_api_PodSpec
(
in
*
PodSpec
,
out
*
api
.
PodSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
PodSpec
))(
in
)
}
SetDefaults_PodSpec
(
in
)
if
in
.
Volumes
!=
nil
{
out
.
Volumes
=
make
([]
api
.
Volume
,
len
(
in
.
Volumes
))
for
i
:=
range
in
.
Volumes
{
...
...
@@ -474,10 +462,6 @@ func Convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *api.Service
}
func
Convert_api_PodSecurityContext_To_v1_PodSecurityContext
(
in
*
api
.
PodSecurityContext
,
out
*
PodSecurityContext
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
api
.
PodSecurityContext
))(
in
)
}
out
.
SupplementalGroups
=
in
.
SupplementalGroups
if
in
.
SELinuxOptions
!=
nil
{
out
.
SELinuxOptions
=
new
(
SELinuxOptions
)
...
...
@@ -509,10 +493,6 @@ func Convert_api_PodSecurityContext_To_v1_PodSecurityContext(in *api.PodSecurity
}
func
Convert_v1_PodSecurityContext_To_api_PodSecurityContext
(
in
*
PodSecurityContext
,
out
*
api
.
PodSecurityContext
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
PodSecurityContext
))(
in
)
}
out
.
SupplementalGroups
=
in
.
SupplementalGroups
if
in
.
SELinuxOptions
!=
nil
{
out
.
SELinuxOptions
=
new
(
api
.
SELinuxOptions
)
...
...
@@ -544,9 +524,6 @@ func Convert_v1_PodSecurityContext_To_api_PodSecurityContext(in *PodSecurityCont
}
func
Convert_v1_ResourceList_To_api_ResourceList
(
in
*
ResourceList
,
out
*
api
.
ResourceList
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
ResourceList
))(
in
)
}
if
*
in
==
nil
{
return
nil
}
...
...
pkg/apis/apps/v1alpha1/conversion.go
View file @
db5a851d
...
...
@@ -18,7 +18,6 @@ package v1alpha1
import
(
"fmt"
"reflect"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
...
...
@@ -58,9 +57,6 @@ func addConversionFuncs(scheme *runtime.Scheme) {
}
func
Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec
(
in
*
PetSetSpec
,
out
*
apps
.
PetSetSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
PetSetSpec
))(
in
)
}
if
in
.
Replicas
!=
nil
{
out
.
Replicas
=
int
(
*
in
.
Replicas
)
}
...
...
@@ -92,9 +88,6 @@ func Convert_v1alpha1_PetSetSpec_To_apps_PetSetSpec(in *PetSetSpec, out *apps.Pe
}
func
Convert_apps_PetSetSpec_To_v1alpha1_PetSetSpec
(
in
*
apps
.
PetSetSpec
,
out
*
PetSetSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
apps
.
PetSetSpec
))(
in
)
}
out
.
Replicas
=
new
(
int32
)
*
out
.
Replicas
=
int32
(
in
.
Replicas
)
if
in
.
Selector
!=
nil
{
...
...
pkg/apis/autoscaling/v1/conversion.go
View file @
db5a851d
...
...
@@ -17,8 +17,6 @@ limitations under the License.
package
v1
import
(
"reflect"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
...
...
@@ -39,9 +37,6 @@ func addConversionFuncs(scheme *runtime.Scheme) {
}
func
Convert_extensions_SubresourceReference_To_v1_CrossVersionObjectReference
(
in
*
extensions
.
SubresourceReference
,
out
*
CrossVersionObjectReference
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
extensions
.
SubresourceReference
))(
in
)
}
out
.
Kind
=
in
.
Kind
out
.
Name
=
in
.
Name
out
.
APIVersion
=
in
.
APIVersion
...
...
@@ -49,9 +44,6 @@ func Convert_extensions_SubresourceReference_To_v1_CrossVersionObjectReference(i
}
func
Convert_v1_CrossVersionObjectReference_To_extensions_SubresourceReference
(
in
*
CrossVersionObjectReference
,
out
*
extensions
.
SubresourceReference
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
CrossVersionObjectReference
))(
in
)
}
out
.
Kind
=
in
.
Kind
out
.
Name
=
in
.
Name
out
.
APIVersion
=
in
.
APIVersion
...
...
@@ -60,9 +52,6 @@ func Convert_v1_CrossVersionObjectReference_To_extensions_SubresourceReference(i
}
func
Convert_extensions_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAutoscalerSpec
(
in
*
extensions
.
HorizontalPodAutoscalerSpec
,
out
*
HorizontalPodAutoscalerSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
extensions
.
HorizontalPodAutoscalerSpec
))(
in
)
}
if
err
:=
Convert_extensions_SubresourceReference_To_v1_CrossVersionObjectReference
(
&
in
.
ScaleRef
,
&
out
.
ScaleTargetRef
,
s
);
err
!=
nil
{
return
err
}
...
...
@@ -81,9 +70,6 @@ func Convert_extensions_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAutoscale
}
func
Convert_v1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscalerSpec
(
in
*
HorizontalPodAutoscalerSpec
,
out
*
extensions
.
HorizontalPodAutoscalerSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
HorizontalPodAutoscalerSpec
))(
in
)
}
if
err
:=
Convert_v1_CrossVersionObjectReference_To_extensions_SubresourceReference
(
&
in
.
ScaleTargetRef
,
&
out
.
ScaleRef
,
s
);
err
!=
nil
{
return
err
}
...
...
pkg/apis/batch/v1/conversion.go
View file @
db5a851d
...
...
@@ -18,7 +18,6 @@ package v1
import
(
"fmt"
"reflect"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
...
...
@@ -55,9 +54,6 @@ func addConversionFuncs(scheme *runtime.Scheme) {
}
func
Convert_batch_JobSpec_To_v1_JobSpec
(
in
*
batch
.
JobSpec
,
out
*
JobSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
batch
.
JobSpec
))(
in
)
}
out
.
Parallelism
=
in
.
Parallelism
out
.
Completions
=
in
.
Completions
out
.
ActiveDeadlineSeconds
=
in
.
ActiveDeadlineSeconds
...
...
@@ -84,9 +80,6 @@ func Convert_batch_JobSpec_To_v1_JobSpec(in *batch.JobSpec, out *JobSpec, s conv
}
func
Convert_v1_JobSpec_To_batch_JobSpec
(
in
*
JobSpec
,
out
*
batch
.
JobSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
JobSpec
))(
in
)
}
out
.
Parallelism
=
in
.
Parallelism
out
.
Completions
=
in
.
Completions
out
.
ActiveDeadlineSeconds
=
in
.
ActiveDeadlineSeconds
...
...
pkg/apis/extensions/v1beta1/conversion.go
View file @
db5a851d
...
...
@@ -18,7 +18,6 @@ package v1beta1
import
(
"fmt"
"reflect"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
...
...
@@ -85,9 +84,6 @@ func addConversionFuncs(scheme *runtime.Scheme) {
}
func
Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus
(
in
*
extensions
.
ScaleStatus
,
out
*
ScaleStatus
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
extensions
.
ScaleStatus
))(
in
)
}
out
.
Replicas
=
int32
(
in
.
Replicas
)
out
.
Selector
=
nil
...
...
@@ -107,9 +103,6 @@ func Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleS
}
func
Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus
(
in
*
ScaleStatus
,
out
*
extensions
.
ScaleStatus
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
ScaleStatus
))(
in
)
}
out
.
Replicas
=
in
.
Replicas
// Normally when 2 fields map to the same internal value we favor the old field, since
...
...
@@ -137,9 +130,6 @@ func Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *ScaleStatus, out
}
func
Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec
(
in
*
extensions
.
DeploymentSpec
,
out
*
DeploymentSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
extensions
.
DeploymentSpec
))(
in
)
}
out
.
Replicas
=
&
in
.
Replicas
if
in
.
Selector
!=
nil
{
out
.
Selector
=
new
(
LabelSelector
)
...
...
@@ -171,9 +161,6 @@ func Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.
}
func
Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec
(
in
*
DeploymentSpec
,
out
*
extensions
.
DeploymentSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
DeploymentSpec
))(
in
)
}
if
in
.
Replicas
!=
nil
{
out
.
Replicas
=
*
in
.
Replicas
}
...
...
@@ -205,9 +192,6 @@ func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentS
}
func
Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy
(
in
*
extensions
.
DeploymentStrategy
,
out
*
DeploymentStrategy
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
extensions
.
DeploymentStrategy
))(
in
)
}
out
.
Type
=
DeploymentStrategyType
(
in
.
Type
)
if
in
.
RollingUpdate
!=
nil
{
out
.
RollingUpdate
=
new
(
RollingUpdateDeployment
)
...
...
@@ -221,9 +205,6 @@ func Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(in *ext
}
func
Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy
(
in
*
DeploymentStrategy
,
out
*
extensions
.
DeploymentStrategy
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
DeploymentStrategy
))(
in
)
}
out
.
Type
=
extensions
.
DeploymentStrategyType
(
in
.
Type
)
if
in
.
RollingUpdate
!=
nil
{
out
.
RollingUpdate
=
new
(
extensions
.
RollingUpdateDeployment
)
...
...
@@ -237,9 +218,6 @@ func Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(in *Dep
}
func
Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment
(
in
*
extensions
.
RollingUpdateDeployment
,
out
*
RollingUpdateDeployment
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
extensions
.
RollingUpdateDeployment
))(
in
)
}
if
out
.
MaxUnavailable
==
nil
{
out
.
MaxUnavailable
=
&
intstr
.
IntOrString
{}
}
...
...
@@ -256,9 +234,6 @@ func Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployme
}
func
Convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment
(
in
*
RollingUpdateDeployment
,
out
*
extensions
.
RollingUpdateDeployment
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
RollingUpdateDeployment
))(
in
)
}
if
err
:=
s
.
Convert
(
in
.
MaxUnavailable
,
&
out
.
MaxUnavailable
,
0
);
err
!=
nil
{
return
err
}
...
...
@@ -269,9 +244,6 @@ func Convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployme
}
func
Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec
(
in
*
extensions
.
ReplicaSetSpec
,
out
*
ReplicaSetSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
extensions
.
ReplicaSetSpec
))(
in
)
}
out
.
Replicas
=
new
(
int32
)
*
out
.
Replicas
=
int32
(
in
.
Replicas
)
if
in
.
Selector
!=
nil
{
...
...
@@ -290,9 +262,6 @@ func Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec(in *extensions.
}
func
Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec
(
in
*
ReplicaSetSpec
,
out
*
extensions
.
ReplicaSetSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
ReplicaSetSpec
))(
in
)
}
if
in
.
Replicas
!=
nil
{
out
.
Replicas
=
*
in
.
Replicas
}
...
...
@@ -311,9 +280,6 @@ func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetS
}
func
Convert_batch_JobSpec_To_v1beta1_JobSpec
(
in
*
batch
.
JobSpec
,
out
*
JobSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
batch
.
JobSpec
))(
in
)
}
out
.
Parallelism
=
in
.
Parallelism
out
.
Completions
=
in
.
Completions
out
.
ActiveDeadlineSeconds
=
in
.
ActiveDeadlineSeconds
...
...
@@ -348,9 +314,6 @@ func Convert_batch_JobSpec_To_v1beta1_JobSpec(in *batch.JobSpec, out *JobSpec, s
}
func
Convert_v1beta1_JobSpec_To_batch_JobSpec
(
in
*
JobSpec
,
out
*
batch
.
JobSpec
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
JobSpec
))(
in
)
}
out
.
Parallelism
=
in
.
Parallelism
out
.
Completions
=
in
.
Completions
out
.
ActiveDeadlineSeconds
=
in
.
ActiveDeadlineSeconds
...
...
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