Skip to content

Commit

Permalink
deploy: api for deploymentconfig Conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmichalis committed Oct 5, 2016
1 parent 8cff42a commit 103e877
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pkg/deploy/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ type DeploymentConfigStatus struct {
// Details are the reasons for the update to this deployment config.
// This could be based on a change made by the user or caused by an automatic trigger
Details *DeploymentDetails
// Conditions represents the latest available observations of a deployment config's current state.
Conditions []DeploymentCondition
}

// DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.
Expand Down Expand Up @@ -409,6 +411,37 @@ type DeploymentCauseImageTrigger struct {
From kapi.ObjectReference
}

type DeploymentConditionType string

// These are valid conditions of a deployment config.
const (
// DeploymentAvailable means the deployment config is available, ie. at least the minimum available
// replicas required are up and running for at least minReadySeconds.
DeploymentAvailable DeploymentConditionType = "Available"
// DeploymentProgressing means the deployment config is progressing. Progress for a deployment
// config 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 deployment configs, when the deployment
// config needs to rollback, or when progressDeadlineSeconds is not specified.
DeploymentProgressing DeploymentConditionType = "Progressing"
// DeploymentReplicaFailure is added in a deployment config when one of its pods
// fails to be created or deleted.
DeploymentReplicaFailure DeploymentConditionType = "ReplicaFailure"
)

// DeploymentCondition describes the state of a deployment config at a certain point.
type DeploymentCondition struct {
// Type of deployment condition.
Type DeploymentConditionType
// Status of the condition, one of True, False, Unknown.
Status kapi.ConditionStatus
// The last time the condition transitioned from one status to another.
LastTransitionTime unversioned.Time
// The reason for the condition's last transition.
Reason string
// A human readable message indicating details about the transition.
Message string
}

// DeploymentConfigList is a collection of deployment configs.
type DeploymentConfigList struct {
unversioned.TypeMeta
Expand Down
33 changes: 33 additions & 0 deletions pkg/deploy/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ type DeploymentConfigStatus struct {
// Details are the reasons for the update to this deployment config.
// This could be based on a change made by the user or caused by an automatic trigger
Details *DeploymentDetails `json:"details,omitempty" protobuf:"bytes,7,opt,name=details"`
// Conditions represents the latest available observations of a deployment config's current state.
Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

// DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.
Expand Down Expand Up @@ -384,6 +386,37 @@ type DeploymentCauseImageTrigger struct {
From kapi.ObjectReference `json:"from" protobuf:"bytes,1,opt,name=from"`
}

type DeploymentConditionType string

// These are valid conditions of a deployment config.
const (
// DeploymentAvailable means the deployment config is available, ie. at least the minimum available
// replicas required are up and running for at least minReadySeconds.
DeploymentAvailable DeploymentConditionType = "Available"
// DeploymentProgressing means the deployment config is progressing. Progress for a deployment
// config 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 deployment configs, when the deployment
// config needs to rollback, or when progressDeadlineSeconds is not specified.
DeploymentProgressing DeploymentConditionType = "Progressing"
// DeploymentReplicaFailure is added in a deployment config when one of its pods
// fails to be created or deleted.
DeploymentReplicaFailure DeploymentConditionType = "ReplicaFailure"
)

// DeploymentCondition describes the state of a deployment config 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 kapi.ConditionStatus `json:"status"`
// The 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"`
}

// DeploymentConfigList is a collection of deployment configs.
type DeploymentConfigList struct {
unversioned.TypeMeta `json:",inline"`
Expand Down

0 comments on commit 103e877

Please sign in to comment.