Skip to content

Commit

Permalink
Merge pull request #6233 from kargakis/dc-new-api-field
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Jun 23, 2016
2 parents 6a45bc7 + 0e85054 commit cc9cf0e
Show file tree
Hide file tree
Showing 17 changed files with 270 additions and 126 deletions.
32 changes: 26 additions & 6 deletions api/swagger-spec/oapi-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -21797,16 +21797,36 @@
"latestVersion": {
"type": "integer",
"format": "int64",
"description": "LatestVersion is used to determine whether the current deployment associated with a DeploymentConfig is out of sync."
},
"details": {
"$ref": "v1.DeploymentDetails",
"description": "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"
"description": "LatestVersion is used to determine whether the current deployment associated with a deployment config is out of sync."
},
"observedGeneration": {
"type": "integer",
"format": "int64",
"description": "ObservedGeneration is the most recent generation observed by the controller."
"description": "ObservedGeneration is the most recent generation observed by the deployment config controller."
},
"replicas": {
"type": "integer",
"format": "int32",
"description": "Replicas is the total number of pods targeted by this deployment config."
},
"updatedReplicas": {
"type": "integer",
"format": "int32",
"description": "UpdatedReplicas is the total number of non-terminated pods targeted by this deployment config that have the desired template spec."
},
"availableReplicas": {
"type": "integer",
"format": "int32",
"description": "AvailableReplicas is the total number of available pods targeted by this deployment config."
},
"unavailableReplicas": {
"type": "integer",
"format": "int32",
"description": "UnavailableReplicas is the total number of unavailable pods targeted by this deployment config."
},
"details": {
"$ref": "v1.DeploymentDetails",
"description": "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"
}
}
},
Expand Down
18 changes: 7 additions & 11 deletions pkg/cmd/cli/describe/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ var (
imageStreamColumns = []string{"NAME", "DOCKER REPO", "TAGS", "UPDATED"}
projectColumns = []string{"NAME", "DISPLAY NAME", "STATUS"}
routeColumns = []string{"NAME", "HOST/PORT", "PATH", "SERVICE", "TERMINATION", "LABELS"}
deploymentColumns = []string{"NAME", "STATUS", "CAUSE"}
deploymentConfigColumns = []string{"NAME", "REVISION", "REPLICAS", "TRIGGERED BY"}
deploymentConfigColumns = []string{"NAME", "REVISION", "DESIRED", "CURRENT", "TRIGGERED BY"}
templateColumns = []string{"NAME", "DESCRIPTION", "PARAMETERS", "OBJECTS"}
policyColumns = []string{"NAME", "ROLES", "LAST MODIFIED"}
policyBindingColumns = []string{"NAME", "ROLE BINDINGS", "LAST MODIFIED"}
Expand Down Expand Up @@ -533,11 +532,11 @@ func printRouteList(routeList *routeapi.RouteList, w io.Writer, opts kctl.PrintO
}

func printDeploymentConfig(dc *deployapi.DeploymentConfig, w io.Writer, opts kctl.PrintOptions) error {
var scale string
var desired string
if dc.Spec.Test {
scale = fmt.Sprintf("%d (during test)", dc.Spec.Replicas)
desired = fmt.Sprintf("%d (during test)", dc.Spec.Replicas)
} else {
scale = fmt.Sprintf("%d", dc.Spec.Replicas)
desired = fmt.Sprintf("%d", dc.Spec.Replicas)
}

containers := sets.NewString()
Expand Down Expand Up @@ -580,14 +579,11 @@ func printDeploymentConfig(dc *deployapi.DeploymentConfig, w io.Writer, opts kct
return err
}
}
if _, err := fmt.Fprintf(w, "%s\t%v\t%s\t%s", dc.Name, dc.Status.LatestVersion, scale, trigger); err != nil {
if _, err := fmt.Fprintf(w, "%s\t%d\t%s\t%d\t%s", dc.Name, dc.Status.LatestVersion, desired, dc.Status.UpdatedReplicas, trigger); err != nil {
return err
}
if err := appendItemLabels(dc.Labels, w, opts.ColumnLabels, opts.ShowLabels); err != nil {
return err
}

return nil
err := appendItemLabels(dc.Labels, w, opts.ColumnLabels, opts.ShowLabels)
return err
}

func printDeploymentConfigList(list *deployapi.DeploymentConfigList, w io.Writer, opts kctl.PrintOptions) error {
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/server/origin/run_components.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,10 @@ func (c *MasterConfig) RunDeployerPodController() {
func (c *MasterConfig) RunDeploymentConfigController() {
dcInfomer := c.Informers.DeploymentConfigs().Informer()
rcInformer := c.Informers.ReplicationControllers().Informer()
podInformer := c.Informers.Pods().Informer()
osclient, kclient := c.DeploymentConfigControllerClients()

controller := deployconfigcontroller.NewDeploymentConfigController(dcInfomer, rcInformer, osclient, kclient, c.EtcdHelper.Codec())
controller := deployconfigcontroller.NewDeploymentConfigController(dcInfomer, rcInformer, podInformer, osclient, kclient, c.EtcdHelper.Codec())
// TODO: Make the stop channel actually work.
stopCh := make(chan struct{})
// TODO: Make the number of workers configurable.
Expand Down
6 changes: 5 additions & 1 deletion pkg/deploy/api/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ func DeepCopy_api_DeploymentConfigSpec(in DeploymentConfigSpec, out *DeploymentC

func DeepCopy_api_DeploymentConfigStatus(in DeploymentConfigStatus, out *DeploymentConfigStatus, c *conversion.Cloner) error {
out.LatestVersion = in.LatestVersion
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = in.Replicas
out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = in.UnavailableReplicas
if in.Details != nil {
in, out := in.Details, &out.Details
*out = new(DeploymentDetails)
Expand All @@ -193,7 +198,6 @@ func DeepCopy_api_DeploymentConfigStatus(in DeploymentConfigStatus, out *Deploym
} else {
out.Details = nil
}
out.ObservedGeneration = in.ObservedGeneration
return nil
}

Expand Down
12 changes: 12 additions & 0 deletions pkg/deploy/api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"

imageapi "github.com/openshift/origin/pkg/image/api"
Expand Down Expand Up @@ -32,8 +33,19 @@ func ScaleFromConfig(dc *DeploymentConfig) *extensions.Scale {
ObjectMeta: kapi.ObjectMeta{
Name: dc.Name,
Namespace: dc.Namespace,
UID: dc.UID,
ResourceVersion: dc.ResourceVersion,
CreationTimestamp: dc.CreationTimestamp,
},
Spec: extensions.ScaleSpec{
Replicas: dc.Spec.Replicas,
},
Status: extensions.ScaleStatus{
Replicas: dc.Status.Replicas,
Selector: &unversioned.LabelSelector{
MatchLabels: dc.Spec.Selector,
},
},
}
}

Expand Down
17 changes: 13 additions & 4 deletions pkg/deploy/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,23 @@ type DeploymentConfigSpec struct {

// DeploymentConfigStatus represents the current deployment state.
type DeploymentConfigStatus struct {
// LatestVersion is used to determine whether the current deployment associated with a DeploymentConfig
// is out of sync.
// LatestVersion is used to determine whether the current deployment associated with a deployment
// config is out of sync.
LatestVersion int64
// ObservedGeneration is the most recent generation observed by the deployment config controller.
ObservedGeneration int64
// Replicas is the total number of pods targeted by this deployment config.
Replicas int32
// UpdatedReplicas is the total number of non-terminated pods targeted by this deployment config
// that have the desired template spec.
UpdatedReplicas int32
// AvailableReplicas is the total number of available pods targeted by this deployment config.
AvailableReplicas int32
// UnavailableReplicas is the total number of unavailable pods targeted by this deployment config.
UnavailableReplicas int32
// 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
// ObservedGeneration is the most recent generation observed by the controller.
ObservedGeneration int64
}

// DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.
Expand Down
12 changes: 10 additions & 2 deletions pkg/deploy/api/v1/conversion_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ func Convert_api_DeploymentConfigSpec_To_v1_DeploymentConfigSpec(in *deploy_api.

func autoConvert_v1_DeploymentConfigStatus_To_api_DeploymentConfigStatus(in *DeploymentConfigStatus, out *deploy_api.DeploymentConfigStatus, s conversion.Scope) error {
out.LatestVersion = in.LatestVersion
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = in.Replicas
out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = in.UnavailableReplicas
if in.Details != nil {
in, out := &in.Details, &out.Details
*out = new(deploy_api.DeploymentDetails)
Expand All @@ -429,7 +434,6 @@ func autoConvert_v1_DeploymentConfigStatus_To_api_DeploymentConfigStatus(in *Dep
} else {
out.Details = nil
}
out.ObservedGeneration = in.ObservedGeneration
return nil
}

Expand All @@ -439,6 +443,11 @@ func Convert_v1_DeploymentConfigStatus_To_api_DeploymentConfigStatus(in *Deploym

func autoConvert_api_DeploymentConfigStatus_To_v1_DeploymentConfigStatus(in *deploy_api.DeploymentConfigStatus, out *DeploymentConfigStatus, s conversion.Scope) error {
out.LatestVersion = in.LatestVersion
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = in.Replicas
out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = in.UnavailableReplicas
if in.Details != nil {
in, out := &in.Details, &out.Details
*out = new(DeploymentDetails)
Expand All @@ -448,7 +457,6 @@ func autoConvert_api_DeploymentConfigStatus_To_v1_DeploymentConfigStatus(in *dep
} else {
out.Details = nil
}
out.ObservedGeneration = in.ObservedGeneration
return nil
}

Expand Down
6 changes: 5 additions & 1 deletion pkg/deploy/api/v1/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ func DeepCopy_v1_DeploymentConfigSpec(in DeploymentConfigSpec, out *DeploymentCo

func DeepCopy_v1_DeploymentConfigStatus(in DeploymentConfigStatus, out *DeploymentConfigStatus, c *conversion.Cloner) error {
out.LatestVersion = in.LatestVersion
out.ObservedGeneration = in.ObservedGeneration
out.Replicas = in.Replicas
out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = in.UnavailableReplicas
if in.Details != nil {
in, out := in.Details, &out.Details
*out = new(DeploymentDetails)
Expand All @@ -192,7 +197,6 @@ func DeepCopy_v1_DeploymentConfigStatus(in DeploymentConfigStatus, out *Deployme
} else {
out.Details = nil
}
out.ObservedGeneration = in.ObservedGeneration
return nil
}

Expand Down
12 changes: 8 additions & 4 deletions pkg/deploy/api/v1/swagger_doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ func (DeploymentConfigSpec) SwaggerDoc() map[string]string {
}

var map_DeploymentConfigStatus = map[string]string{
"": "DeploymentConfigStatus represents the current deployment state.",
"latestVersion": "LatestVersion is used to determine whether the current deployment associated with a DeploymentConfig is out of sync.",
"details": "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",
"observedGeneration": "ObservedGeneration is the most recent generation observed by the controller.",
"": "DeploymentConfigStatus represents the current deployment state.",
"latestVersion": "LatestVersion is used to determine whether the current deployment associated with a deployment config is out of sync.",
"observedGeneration": "ObservedGeneration is the most recent generation observed by the deployment config controller.",
"replicas": "Replicas is the total number of pods targeted by this deployment config.",
"updatedReplicas": "UpdatedReplicas is the total number of non-terminated pods targeted by this deployment config that have the desired template spec.",
"availableReplicas": "AvailableReplicas is the total number of available pods targeted by this deployment config.",
"unavailableReplicas": "UnavailableReplicas is the total number of unavailable pods targeted by this deployment config.",
"details": "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",
}

func (DeploymentConfigStatus) SwaggerDoc() map[string]string {
Expand Down
17 changes: 13 additions & 4 deletions pkg/deploy/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,23 @@ type DeploymentConfigSpec struct {

// DeploymentConfigStatus represents the current deployment state.
type DeploymentConfigStatus struct {
// LatestVersion is used to determine whether the current deployment associated with a DeploymentConfig
// is out of sync.
// LatestVersion is used to determine whether the current deployment associated with a deployment
// config is out of sync.
LatestVersion int64 `json:"latestVersion,omitempty"`
// ObservedGeneration is the most recent generation observed by the deployment config controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Replicas is the total number of pods targeted by this deployment config.
Replicas int32 `json:"replicas,omitempty"`
// UpdatedReplicas is the total number of non-terminated pods targeted by this deployment config
// that have the desired template spec.
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
// AvailableReplicas is the total number of available pods targeted by this deployment config.
AvailableReplicas int32 `json:"availableReplicas,omitempty"`
// UnavailableReplicas is the total number of unavailable pods targeted by this deployment config.
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"`
// 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"`
// ObservedGeneration is the most recent generation observed by the controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.
Expand Down
17 changes: 13 additions & 4 deletions pkg/deploy/api/v1beta3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,23 @@ type DeploymentConfigSpec struct {
}

type DeploymentConfigStatus struct {
// LatestVersion is used to determine whether the current deployment associated with a DeploymentConfig
// is out of sync.
// LatestVersion is used to determine whether the current deployment associated with a deployment
// config is out of sync.
LatestVersion int64 `json:"latestVersion,omitempty"`
// ObservedGeneration is the most recent generation observed by the deployment config controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Replicas is the total number of pods targeted by this deployment config.
Replicas int32 `json:"replicas,omitempty"`
// UpdatedReplicas is the total number of non-terminated pods targeted by this deployment config
// that have the desired template spec.
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
// AvailableReplicas is the total number of available pods targeted by this deployment config.
AvailableReplicas int32 `json:"availableReplicas,omitempty"`
// UnavailableReplicas is the total number of unavailable pods targeted by this deployment config.
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"`
// 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"`
// ObservedGeneration is the most recent generation observed by the controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// DeploymentTriggerPolicy describes a policy for a single trigger that results in a new deployment.
Expand Down
Loading

0 comments on commit cc9cf0e

Please sign in to comment.