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
957ce699
Commit
957ce699
authored
Feb 13, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #20906 from kargakis/status-updates-in-deployments
Auto commit by PR queue bot
parents
315a5093
47a94fd0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
strategy.go
pkg/registry/deployment/strategy.go
+1
-0
strategy_test.go
pkg/registry/deployment/strategy_test.go
+55
-1
No files found.
pkg/registry/deployment/strategy.go
View file @
957ce699
...
@@ -92,6 +92,7 @@ func (deploymentStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
...
@@ -92,6 +92,7 @@ func (deploymentStatusStrategy) PrepareForUpdate(obj, old runtime.Object) {
newDeployment
:=
obj
.
(
*
extensions
.
Deployment
)
newDeployment
:=
obj
.
(
*
extensions
.
Deployment
)
oldDeployment
:=
old
.
(
*
extensions
.
Deployment
)
oldDeployment
:=
old
.
(
*
extensions
.
Deployment
)
newDeployment
.
Spec
=
oldDeployment
.
Spec
newDeployment
.
Spec
=
oldDeployment
.
Spec
newDeployment
.
Labels
=
oldDeployment
.
Labels
}
}
// ValidateUpdate is the default update validation for an end user updating status
// ValidateUpdate is the default update validation for an end user updating status
...
...
pkg/registry/deployment/strategy_test.go
View file @
957ce699
...
@@ -17,13 +17,15 @@ limitations under the License.
...
@@ -17,13 +17,15 @@ limitations under the License.
package
deployment
package
deployment
import
(
import
(
"reflect"
"testing"
"testing"
_
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
apitesting
"k8s.io/kubernetes/pkg/api/testing"
apitesting
"k8s.io/kubernetes/pkg/api/testing"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
)
)
func
TestSelectableFieldLabelConversions
(
t
*
testing
.
T
)
{
func
TestSelectableFieldLabelConversions
(
t
*
testing
.
T
)
{
...
@@ -34,3 +36,55 @@ func TestSelectableFieldLabelConversions(t *testing.T) {
...
@@ -34,3 +36,55 @@ func TestSelectableFieldLabelConversions(t *testing.T) {
nil
,
nil
,
)
)
}
}
func
TestStatusUpdates
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
old
runtime
.
Object
obj
runtime
.
Object
expected
runtime
.
Object
}{
{
old
:
newDeployment
(
map
[
string
]
string
{
"test"
:
"label"
},
map
[
string
]
string
{
"test"
:
"annotation"
}),
obj
:
newDeployment
(
map
[
string
]
string
{
"test"
:
"label"
,
"sneaky"
:
"label"
},
map
[
string
]
string
{
"test"
:
"annotation"
}),
expected
:
newDeployment
(
map
[
string
]
string
{
"test"
:
"label"
},
map
[
string
]
string
{
"test"
:
"annotation"
}),
},
{
old
:
newDeployment
(
map
[
string
]
string
{
"test"
:
"label"
},
map
[
string
]
string
{
"test"
:
"annotation"
}),
obj
:
newDeployment
(
map
[
string
]
string
{
"test"
:
"label"
},
map
[
string
]
string
{
"test"
:
"annotation"
,
"sneaky"
:
"annotation"
}),
expected
:
newDeployment
(
map
[
string
]
string
{
"test"
:
"label"
},
map
[
string
]
string
{
"test"
:
"annotation"
,
"sneaky"
:
"annotation"
}),
},
}
for
_
,
test
:=
range
tests
{
deploymentStatusStrategy
{}
.
PrepareForUpdate
(
test
.
obj
,
test
.
old
)
if
!
reflect
.
DeepEqual
(
test
.
expected
,
test
.
obj
)
{
t
.
Errorf
(
"Unexpected object mismatch! Expected:
\n
%#v
\n
got:
\n
%#v"
,
test
.
expected
,
test
.
obj
)
}
}
}
func
newDeployment
(
labels
,
annotations
map
[
string
]
string
)
*
extensions
.
Deployment
{
return
&
extensions
.
Deployment
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"test"
,
Labels
:
labels
,
Annotations
:
annotations
,
},
Spec
:
extensions
.
DeploymentSpec
{
Replicas
:
1
,
Strategy
:
extensions
.
DeploymentStrategy
{
Type
:
extensions
.
RecreateDeploymentStrategyType
,
},
Template
:
api
.
PodTemplateSpec
{
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
{
Name
:
"test"
,
Image
:
"test"
,
},
},
},
},
},
}
}
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