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
f79736d7
Commit
f79736d7
authored
Jun 22, 2015
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make replicas a pointer in v1beta3 api
parent
2906f852
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
54 deletions
+63
-54
types.go
pkg/api/v1/types.go
+1
-1
conversion.go
pkg/api/v1beta3/conversion.go
+50
-0
conversion_generated.go
pkg/api/v1beta3/conversion_generated.go
+0
-50
deep_copy_generated.go
pkg/api/v1beta3/deep_copy_generated.go
+6
-1
defaults.go
pkg/api/v1beta3/defaults.go
+4
-0
types.go
pkg/api/v1beta3/types.go
+2
-2
No files found.
pkg/api/v1/types.go
View file @
f79736d7
...
...
@@ -953,7 +953,7 @@ type PodTemplateList struct {
// ReplicationControllerSpec is the specification of a replication controller.
type
ReplicationControllerSpec
struct
{
// Replicas is the number of desired replicas.
// Replicas is the number of desired replicas.
This is a pointer to distinguish between explicit zero and unspecified.
Replicas
*
int
`json:"replicas,omitempty" description:"number of replicas desired; defaults to 1"`
// Selector is a label query over pods that should match the Replicas count.
...
...
pkg/api/v1beta3/conversion.go
View file @
f79736d7
...
...
@@ -41,6 +41,8 @@ func addConversionFuncs() {
convert_api_StatusDetails_To_v1beta3_StatusDetails
,
convert_v1beta3_StatusCause_To_api_StatusCause
,
convert_api_StatusCause_To_v1beta3_StatusCause
,
convert_api_ReplicationControllerSpec_To_v1beta3_ReplicationControllerSpec
,
convert_v1beta3_ReplicationControllerSpec_To_api_ReplicationControllerSpec
,
)
if
err
!=
nil
{
// If one of the conversion functions is malformed, detect it immediately.
...
...
@@ -726,3 +728,51 @@ func convert_api_StatusCause_To_v1beta3_StatusCause(in *api.StatusCause, out *St
out
.
Field
=
in
.
Field
return
nil
}
func
convert_api_ReplicationControllerSpec_To_v1beta3_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
=
&
in
.
Replicas
if
in
.
Selector
!=
nil
{
out
.
Selector
=
make
(
map
[
string
]
string
)
for
key
,
val
:=
range
in
.
Selector
{
out
.
Selector
[
key
]
=
val
}
}
else
{
out
.
Selector
=
nil
}
if
in
.
Template
!=
nil
{
out
.
Template
=
new
(
PodTemplateSpec
)
if
err
:=
convert_api_PodTemplateSpec_To_v1beta3_PodTemplateSpec
(
in
.
Template
,
out
.
Template
,
s
);
err
!=
nil
{
return
err
}
}
else
{
out
.
Template
=
nil
}
return
nil
}
func
convert_v1beta3_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
)
for
key
,
val
:=
range
in
.
Selector
{
out
.
Selector
[
key
]
=
val
}
}
else
{
out
.
Selector
=
nil
}
if
in
.
Template
!=
nil
{
out
.
Template
=
new
(
api
.
PodTemplateSpec
)
if
err
:=
convert_v1beta3_PodTemplateSpec_To_api_PodTemplateSpec
(
in
.
Template
,
out
.
Template
,
s
);
err
!=
nil
{
return
err
}
}
else
{
out
.
Template
=
nil
}
return
nil
}
pkg/api/v1beta3/conversion_generated.go
View file @
f79736d7
...
...
@@ -1536,30 +1536,6 @@ func convert_api_ReplicationControllerList_To_v1beta3_ReplicationControllerList(
return
nil
}
func
convert_api_ReplicationControllerSpec_To_v1beta3_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
=
in
.
Replicas
if
in
.
Selector
!=
nil
{
out
.
Selector
=
make
(
map
[
string
]
string
)
for
key
,
val
:=
range
in
.
Selector
{
out
.
Selector
[
key
]
=
val
}
}
else
{
out
.
Selector
=
nil
}
if
in
.
Template
!=
nil
{
out
.
Template
=
new
(
PodTemplateSpec
)
if
err
:=
convert_api_PodTemplateSpec_To_v1beta3_PodTemplateSpec
(
in
.
Template
,
out
.
Template
,
s
);
err
!=
nil
{
return
err
}
}
else
{
out
.
Template
=
nil
}
return
nil
}
func
convert_api_ReplicationControllerStatus_To_v1beta3_ReplicationControllerStatus
(
in
*
api
.
ReplicationControllerStatus
,
out
*
ReplicationControllerStatus
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
api
.
ReplicationControllerStatus
))(
in
)
...
...
@@ -3601,30 +3577,6 @@ func convert_v1beta3_ReplicationControllerList_To_api_ReplicationControllerList(
return
nil
}
func
convert_v1beta3_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
)
for
key
,
val
:=
range
in
.
Selector
{
out
.
Selector
[
key
]
=
val
}
}
else
{
out
.
Selector
=
nil
}
if
in
.
Template
!=
nil
{
out
.
Template
=
new
(
api
.
PodTemplateSpec
)
if
err
:=
convert_v1beta3_PodTemplateSpec_To_api_PodTemplateSpec
(
in
.
Template
,
out
.
Template
,
s
);
err
!=
nil
{
return
err
}
}
else
{
out
.
Template
=
nil
}
return
nil
}
func
convert_v1beta3_ReplicationControllerStatus_To_api_ReplicationControllerStatus
(
in
*
ReplicationControllerStatus
,
out
*
api
.
ReplicationControllerStatus
,
s
conversion
.
Scope
)
error
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
ReplicationControllerStatus
))(
in
)
...
...
@@ -4238,7 +4190,6 @@ func init() {
convert_api_RBDVolumeSource_To_v1beta3_RBDVolumeSource
,
convert_api_RangeAllocation_To_v1beta3_RangeAllocation
,
convert_api_ReplicationControllerList_To_v1beta3_ReplicationControllerList
,
convert_api_ReplicationControllerSpec_To_v1beta3_ReplicationControllerSpec
,
convert_api_ReplicationControllerStatus_To_v1beta3_ReplicationControllerStatus
,
convert_api_ReplicationController_To_v1beta3_ReplicationController
,
convert_api_ResourceQuotaList_To_v1beta3_ResourceQuotaList
,
...
...
@@ -4345,7 +4296,6 @@ func init() {
convert_v1beta3_RBDVolumeSource_To_api_RBDVolumeSource
,
convert_v1beta3_RangeAllocation_To_api_RangeAllocation
,
convert_v1beta3_ReplicationControllerList_To_api_ReplicationControllerList
,
convert_v1beta3_ReplicationControllerSpec_To_api_ReplicationControllerSpec
,
convert_v1beta3_ReplicationControllerStatus_To_api_ReplicationControllerStatus
,
convert_v1beta3_ReplicationController_To_api_ReplicationController
,
convert_v1beta3_ResourceQuotaList_To_api_ResourceQuotaList
,
...
...
pkg/api/v1beta3/deep_copy_generated.go
View file @
f79736d7
...
...
@@ -1513,7 +1513,12 @@ func deepCopy_v1beta3_ReplicationControllerList(in ReplicationControllerList, ou
}
func
deepCopy_v1beta3_ReplicationControllerSpec
(
in
ReplicationControllerSpec
,
out
*
ReplicationControllerSpec
,
c
*
conversion
.
Cloner
)
error
{
out
.
Replicas
=
in
.
Replicas
if
in
.
Replicas
!=
nil
{
out
.
Replicas
=
new
(
int
)
*
out
.
Replicas
=
*
in
.
Replicas
}
else
{
out
.
Replicas
=
nil
}
if
in
.
Selector
!=
nil
{
out
.
Selector
=
make
(
map
[
string
]
string
)
for
key
,
val
:=
range
in
.
Selector
{
...
...
pkg/api/v1beta3/defaults.go
View file @
f79736d7
...
...
@@ -40,6 +40,10 @@ func addDefaultingFuncs() {
obj
.
Labels
=
labels
}
}
if
obj
.
Spec
.
Replicas
==
nil
{
obj
.
Spec
.
Replicas
=
new
(
int
)
*
obj
.
Spec
.
Replicas
=
0
}
},
func
(
obj
*
Volume
)
{
if
util
.
AllPtrFieldsNil
(
&
obj
.
VolumeSource
)
{
...
...
pkg/api/v1beta3/types.go
View file @
f79736d7
...
...
@@ -957,8 +957,8 @@ type PodTemplateList struct {
// ReplicationControllerSpec is the specification of a replication controller.
type
ReplicationControllerSpec
struct
{
// Replicas is the number of desired replicas.
Replicas
int
`json:"replicas,omitempty" description:"number of replicas desired"`
// Replicas is the number of desired replicas.
This is a pointer to distinguish between explicit zero and unspecified.
Replicas
*
int
`json:"replicas,omitempty" description:"number of replicas desired"`
// Selector is a label query over pods that should match the Replicas count.
// If Selector is empty, it is defaulted to the labels present on the Pod template.
...
...
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