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
7bb68bc4
Commit
7bb68bc4
authored
Sep 15, 2016
by
Michail Kargakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extensions: api changes for perma-failed deployments
parent
f11d0107
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
2 deletions
+107
-2
types.go
pkg/apis/extensions/types.go
+46
-0
conversion.go
pkg/apis/extensions/v1beta1/conversion.go
+8
-0
defaults_test.go
pkg/apis/extensions/v1beta1/defaults_test.go
+4
-2
types.go
pkg/apis/extensions/v1beta1/types.go
+46
-0
validation.go
pkg/apis/extensions/validation/validation.go
+3
-0
No files found.
pkg/apis/extensions/types.go
View file @
7bb68bc4
...
...
@@ -208,9 +208,19 @@ type DeploymentSpec struct {
// deployment controller.
// +optional
Paused
bool
`json:"paused,omitempty"`
// The config this deployment is rolling back to. Will be cleared after rollback is done.
// +optional
RollbackTo
*
RollbackConfig
`json:"rollbackTo,omitempty"`
// The maximum time in seconds for a deployment to make progress before it
// is considered to be failed. The deployment controller will continue to
// process failed deployments and a condition with a ProgressDeadlineExceeded
// reason will be surfaced in the deployment status. Once autoRollback is
// implemented, the deployment controller will automatically rollback failed
// deployments. Note that progress will not be estimated during the time a
// deployment is paused. This is not set by default.
ProgressDeadlineSeconds
*
int32
`json:"progressDeadlineSeconds,omitempty"`
}
// DeploymentRollback stores the information required to rollback a deployment.
...
...
@@ -311,6 +321,42 @@ type DeploymentStatus struct {
// Total number of unavailable pods targeted by this deployment.
// +optional
UnavailableReplicas
int32
`json:"unavailableReplicas,omitempty"`
// Represents the latest available observations of a deployment's current state.
Conditions
[]
DeploymentCondition
`json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}
type
DeploymentConditionType
string
// These are valid conditions of a deployment.
const
(
// Available means the deployment is available, ie. at least the minimum available
// replicas required are up and running for at least minReadySeconds.
DeploymentAvailable
DeploymentConditionType
=
"Available"
// Progressing means the deployment is progressing. Progress for a deployment is
// considered when a new replica set is created or adopted, and when new pods scale
// up or old pods scale down. Progress is not estimated for paused deployments or
// when progressDeadlineSeconds is not specified.
DeploymentProgressing
DeploymentConditionType
=
"Progressing"
// ReplicaFailure is added in a deployment when one of its pods fails to be created
// or deleted.
DeploymentReplicaFailure
DeploymentConditionType
=
"ReplicaFailure"
)
// DeploymentCondition describes the state of a deployment at a certain point.
type
DeploymentCondition
struct
{
// Type of deployment condition.
Type
DeploymentConditionType
`json:"type"`
// Status of the condition, one of True, False, Unknown.
Status
api
.
ConditionStatus
`json:"status"`
// The last time this condition was updated.
LastUpdateTime
unversioned
.
Time
`json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime
unversioned
.
Time
`json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason
string
`json:"reason,omitempty"`
// A human readable message indicating details about the transition.
Message
string
`json:"message,omitempty"`
}
type
DeploymentList
struct
{
...
...
pkg/apis/extensions/v1beta1/conversion.go
View file @
7bb68bc4
...
...
@@ -153,6 +153,10 @@ func Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.
}
else
{
out
.
RollbackTo
=
nil
}
if
in
.
ProgressDeadlineSeconds
!=
nil
{
out
.
ProgressDeadlineSeconds
=
new
(
int32
)
*
out
.
ProgressDeadlineSeconds
=
*
in
.
ProgressDeadlineSeconds
}
return
nil
}
...
...
@@ -176,6 +180,10 @@ func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentS
}
else
{
out
.
RollbackTo
=
nil
}
if
in
.
ProgressDeadlineSeconds
!=
nil
{
out
.
ProgressDeadlineSeconds
=
new
(
int32
)
*
out
.
ProgressDeadlineSeconds
=
*
in
.
ProgressDeadlineSeconds
}
return
nil
}
...
...
pkg/apis/extensions/v1beta1/defaults_test.go
View file @
7bb68bc4
...
...
@@ -252,6 +252,7 @@ func TestSetDefaultDeployment(t *testing.T) {
Strategy
:
DeploymentStrategy
{
Type
:
RecreateDeploymentStrategyType
,
},
ProgressDeadlineSeconds
:
newInt32
(
30
),
},
},
expected
:
&
Deployment
{
...
...
@@ -260,7 +261,8 @@ func TestSetDefaultDeployment(t *testing.T) {
Strategy
:
DeploymentStrategy
{
Type
:
RecreateDeploymentStrategyType
,
},
Template
:
defaultTemplate
,
Template
:
defaultTemplate
,
ProgressDeadlineSeconds
:
newInt32
(
30
),
},
},
},
...
...
@@ -276,7 +278,7 @@ func TestSetDefaultDeployment(t *testing.T) {
t
.
FailNow
()
}
if
!
reflect
.
DeepEqual
(
got
.
Spec
,
expected
.
Spec
)
{
t
.
Errorf
(
"
got different than
expected:
\n\t
%+v
\n
got:
\n\t
%+v"
,
got
.
Spec
,
expected
.
Spec
)
t
.
Errorf
(
"
object mismatch!
\n
expected:
\n\t
%+v
\n
got:
\n\t
%+v"
,
got
.
Spec
,
expected
.
Spec
)
}
}
}
...
...
pkg/apis/extensions/v1beta1/types.go
View file @
7bb68bc4
...
...
@@ -288,9 +288,19 @@ type DeploymentSpec struct {
// deployment controller.
// +optional
Paused
bool
`json:"paused,omitempty" protobuf:"varint,7,opt,name=paused"`
// The config this deployment is rolling back to. Will be cleared after rollback is done.
// +optional
RollbackTo
*
RollbackConfig
`json:"rollbackTo,omitempty" protobuf:"bytes,8,opt,name=rollbackTo"`
// The maximum time in seconds for a deployment to make progress before it
// is considered to be failed. The deployment controller will continue to
// process failed deployments and a condition with a ProgressDeadlineExceeded
// reason will be surfaced in the deployment status. Once autoRollback is
// implemented, the deployment controller will automatically rollback failed
// deployments. Note that progress will not be estimated during the time a
// deployment is paused. This is not set by default.
ProgressDeadlineSeconds
*
int32
`json:"progressDeadlineSeconds,omitempty"`
}
// DeploymentRollback stores the information required to rollback a deployment.
...
...
@@ -394,6 +404,42 @@ type DeploymentStatus struct {
// Total number of unavailable pods targeted by this deployment.
// +optional
UnavailableReplicas
int32
`json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
// Represents the latest available observations of a deployment's current state.
Conditions
[]
DeploymentCondition
`json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}
type
DeploymentConditionType
string
// These are valid conditions of a deployment.
const
(
// Available means the deployment is available, ie. at least the minimum available
// replicas required are up and running for at least minReadySeconds.
DeploymentAvailable
DeploymentConditionType
=
"Available"
// Progressing means the deployment is progressing. Progress for a deployment is
// considered when a new replica set is created or adopted, and when new pods scale
// up or old pods scale down. Progress is not estimated for paused deployments or
// when progressDeadlineSeconds is not specified.
DeploymentProgressing
DeploymentConditionType
=
"Progressing"
// ReplicaFailure is added in a deployment when one of its pods fails to be created
// or deleted.
DeploymentReplicaFailure
DeploymentConditionType
=
"ReplicaFailure"
)
// DeploymentCondition describes the state of a deployment at a certain point.
type
DeploymentCondition
struct
{
// Type of deployment condition.
Type
DeploymentConditionType
`json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"`
// Status of the condition, one of True, False, Unknown.
Status
v1
.
ConditionStatus
`json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/kubernetes/pkg/api/v1.ConditionStatus"`
// The last time this condition was updated.
LastUpdateTime
unversioned
.
Time
`json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime
unversioned
.
Time
`json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason
string
`json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// A human readable message indicating details about the transition.
Message
string
`json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}
// DeploymentList is a list of Deployments.
...
...
pkg/apis/extensions/validation/validation.go
View file @
7bb68bc4
...
...
@@ -262,6 +262,9 @@ func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path
if
spec
.
RollbackTo
!=
nil
{
allErrs
=
append
(
allErrs
,
ValidateRollback
(
spec
.
RollbackTo
,
fldPath
.
Child
(
"rollback"
))
...
)
}
if
spec
.
ProgressDeadlineSeconds
!=
nil
{
allErrs
=
append
(
allErrs
,
apivalidation
.
ValidateNonnegativeField
(
int64
(
*
spec
.
ProgressDeadlineSeconds
),
fldPath
.
Child
(
"progressDeadlineSeconds"
))
...
)
}
return
allErrs
}
...
...
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