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
bbfc3be5
Unverified
Commit
bbfc3be5
authored
Jan 28, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73096 from yuwenma/golint1
fix golint failure for pkg/controller/deployment/util
parents
3c34d28f
14a1e27d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
.golint_failures
hack/.golint_failures
+0
-1
deployment_util.go
pkg/controller/deployment/util/deployment_util.go
+17
-5
hash_test.go
pkg/controller/deployment/util/hash_test.go
+2
-2
No files found.
hack/.golint_failures
View file @
bbfc3be5
...
@@ -99,7 +99,6 @@ pkg/controller/clusterroleaggregation
...
@@ -99,7 +99,6 @@ pkg/controller/clusterroleaggregation
pkg/controller/cronjob
pkg/controller/cronjob
pkg/controller/daemon
pkg/controller/daemon
pkg/controller/deployment
pkg/controller/deployment
pkg/controller/deployment/util
pkg/controller/disruption
pkg/controller/disruption
pkg/controller/endpoint
pkg/controller/endpoint
pkg/controller/garbagecollector
pkg/controller/garbagecollector
...
...
pkg/controller/deployment/util/deployment_util.go
View file @
bbfc3be5
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
"k8s.io/klog"
"k8s.io/klog"
apps
"k8s.io/api/apps/v1"
apps
"k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
v1
"k8s.io/api/core/v1"
apiequality
"k8s.io/apimachinery/pkg/api/equality"
apiequality
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/meta"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
@@ -61,10 +61,11 @@ const (
...
@@ -61,10 +61,11 @@ const (
RollbackTemplateUnchanged
=
"DeploymentRollbackTemplateUnchanged"
RollbackTemplateUnchanged
=
"DeploymentRollbackTemplateUnchanged"
// RollbackDone is the done rollback event reason
// RollbackDone is the done rollback event reason
RollbackDone
=
"DeploymentRollback"
RollbackDone
=
"DeploymentRollback"
// Reasons for deployment conditions
// Reasons for deployment conditions
//
//
// Progressing:
// Progressing:
//
// ReplicaSetUpdatedReason is added in a deployment when one of its replica sets is updated as part
// ReplicaSetUpdatedReason is added in a deployment when one of its replica sets is updated as part
// of the rollout process.
// of the rollout process.
ReplicaSetUpdatedReason
=
"ReplicaSetUpdated"
ReplicaSetUpdatedReason
=
"ReplicaSetUpdated"
...
@@ -89,7 +90,7 @@ const (
...
@@ -89,7 +90,7 @@ const (
ResumedDeployReason
=
"DeploymentResumed"
ResumedDeployReason
=
"DeploymentResumed"
//
//
// Available:
// Available:
//
// MinimumReplicasAvailable is added in a deployment when it has its minimum replicas required available.
// MinimumReplicasAvailable is added in a deployment when it has its minimum replicas required available.
MinimumReplicasAvailable
=
"MinimumReplicasAvailable"
MinimumReplicasAvailable
=
"MinimumReplicasAvailable"
// MinimumReplicasUnavailable is added in a deployment when it doesn't have the minimum required replicas
// MinimumReplicasUnavailable is added in a deployment when it doesn't have the minimum required replicas
...
@@ -401,7 +402,7 @@ func SetReplicasAnnotations(rs *apps.ReplicaSet, desiredReplicas, maxReplicas in
...
@@ -401,7 +402,7 @@ func SetReplicasAnnotations(rs *apps.ReplicaSet, desiredReplicas, maxReplicas in
return
updated
return
updated
}
}
// AnnotationsNeedUpdate return true if ReplicasAnnotations need to be updated
//
Replicas
AnnotationsNeedUpdate return true if ReplicasAnnotations need to be updated
func
ReplicasAnnotationsNeedUpdate
(
rs
*
apps
.
ReplicaSet
,
desiredReplicas
,
maxReplicas
int32
)
bool
{
func
ReplicasAnnotationsNeedUpdate
(
rs
*
apps
.
ReplicaSet
,
desiredReplicas
,
maxReplicas
int32
)
bool
{
if
rs
.
Annotations
==
nil
{
if
rs
.
Annotations
==
nil
{
return
true
return
true
...
@@ -544,8 +545,12 @@ func RsListFromClient(c appsclient.AppsV1Interface) RsListFunc {
...
@@ -544,8 +545,12 @@ func RsListFromClient(c appsclient.AppsV1Interface) RsListFunc {
}
}
}
}
// TODO: switch this to full namespacers
// TODO: switch RsListFunc and podListFunc to full namespacers
// RsListFunc returns the ReplicaSet from the ReplicaSet namespace and the List metav1.ListOptions.
type
RsListFunc
func
(
string
,
metav1
.
ListOptions
)
([]
*
apps
.
ReplicaSet
,
error
)
type
RsListFunc
func
(
string
,
metav1
.
ListOptions
)
([]
*
apps
.
ReplicaSet
,
error
)
// podListFunc returns the PodList from the Pod namespace and the List metav1.ListOptions.
type
podListFunc
func
(
string
,
metav1
.
ListOptions
)
(
*
v1
.
PodList
,
error
)
type
podListFunc
func
(
string
,
metav1
.
ListOptions
)
(
*
v1
.
PodList
,
error
)
// ListReplicaSets returns a slice of RSes the given deployment targets.
// ListReplicaSets returns a slice of RSes the given deployment targets.
...
@@ -883,9 +888,16 @@ func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired
...
@@ -883,9 +888,16 @@ func ResolveFenceposts(maxSurge, maxUnavailable *intstrutil.IntOrString, desired
return
int32
(
surge
),
int32
(
unavailable
),
nil
return
int32
(
surge
),
int32
(
unavailable
),
nil
}
}
// HasProgressDeadline checks if the Deployment d is expected to surface the reason
// "ProgressDeadlineExceeded" when the Deployment progress takes longer than expected time.
func
HasProgressDeadline
(
d
*
apps
.
Deployment
)
bool
{
func
HasProgressDeadline
(
d
*
apps
.
Deployment
)
bool
{
return
d
.
Spec
.
ProgressDeadlineSeconds
!=
nil
&&
*
d
.
Spec
.
ProgressDeadlineSeconds
!=
math
.
MaxInt32
return
d
.
Spec
.
ProgressDeadlineSeconds
!=
nil
&&
*
d
.
Spec
.
ProgressDeadlineSeconds
!=
math
.
MaxInt32
}
}
// HasRevisionHistoryLimit checks if the Deployment d is expected to keep a specified number of
// old replicaSets. These replicaSets are mainly kept with the purpose of rollback.
// The RevisionHistoryLimit can start from 0 (no retained replicasSet). When set to math.MaxInt32,
// the Deployment will keep all revisions.
func
HasRevisionHistoryLimit
(
d
*
apps
.
Deployment
)
bool
{
func
HasRevisionHistoryLimit
(
d
*
apps
.
Deployment
)
bool
{
return
d
.
Spec
.
RevisionHistoryLimit
!=
nil
&&
*
d
.
Spec
.
RevisionHistoryLimit
!=
math
.
MaxInt32
return
d
.
Spec
.
RevisionHistoryLimit
!=
nil
&&
*
d
.
Spec
.
RevisionHistoryLimit
!=
math
.
MaxInt32
}
}
pkg/controller/deployment/util/hash_test.go
View file @
bbfc3be5
...
@@ -23,12 +23,12 @@ import (
...
@@ -23,12 +23,12 @@ import (
"strings"
"strings"
"testing"
"testing"
"k8s.io/api/core/v1"
v1
"k8s.io/api/core/v1"
"k8s.io/kubernetes/pkg/controller"
"k8s.io/kubernetes/pkg/controller"
hashutil
"k8s.io/kubernetes/pkg/util/hash"
hashutil
"k8s.io/kubernetes/pkg/util/hash"
)
)
var
podSpec
string
=
`
var
podSpec
=
`
{
{
"metadata": {
"metadata": {
"creationTimestamp": null,
"creationTimestamp": null,
...
...
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