Skip to content

Commit

Permalink
🐛 Fix scale-up and improve rig dev host command (#1311)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersjohnsen authored Oct 30, 2024
1 parent 1f7ab58 commit e9df72f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cmd/rig/cmd/dev/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ func (c *Cmd) host(ctx context.Context, cmd *cobra.Command, _ []string) error {
}

if cfg.GetEnvironment() != "" {
c.Scope.GetCurrentContext().SetEnvironmentOverride(cfg.GetEnvironment())
flags.Flags.Environment = cfg.GetEnvironment()
}

if cfg.GetProject() != "" {
c.Scope.GetCurrentContext().SetProjectOverride(cfg.GetProject())
flags.Flags.Project = cfg.GetProject()
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (r *RequestBase) applyChange(ctx context.Context, key ObjectKey, state Reso
newObj := object.New.(*v1.Deployment)
materializedObj := object.Materialized.(*v1.Deployment)
for _, c := range currentObj.Status.Conditions {
if c.Type == v1.DeploymentProgressing && c.Reason == "ReplicaSetUpdated" {
if c.Type == v1.DeploymentProgressing && (c.Reason == "NewReplicaSetCreated" || c.Reason == "ReplicaSetUpdated") {
// We have an ongoing rollout, wait a little with scale-up.
if newObj.Spec.Replicas != nil &&
currentObj.Spec.Replicas != nil &&
Expand Down
11 changes: 8 additions & 3 deletions plugins/capsulesteps/deployment/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,14 @@ func makeImagePullingCondition(container containerInfo) {
break
}

// Override event if latest event is wrong.
if container.status.ImageID != "" && cond.State != apipipeline.ObjectState_OBJECT_STATE_HEALTHY {
// Override event if imageID is present.
if cond.State != apipipeline.ObjectState_OBJECT_STATE_HEALTHY && container.status.ImageID != "" {
cond.State = apipipeline.ObjectState_OBJECT_STATE_HEALTHY
cond.Message = "Image pulled"
}

// Override event if container is running.
if cond.State != apipipeline.ObjectState_OBJECT_STATE_HEALTHY && container.status.State.Running != nil {
cond.State = apipipeline.ObjectState_OBJECT_STATE_HEALTHY
cond.Message = "Image pulled"
}
Expand Down Expand Up @@ -489,7 +495,6 @@ func onDeploymentUpdated(
func OnPodTemplatedUpdated(
template v1.PodTemplateSpec, objectWatcher plugin.ObjectWatcher,
) *apipipeline.ObjectStatusInfo {

objectWatcher.WatchSecondaryByLabels(PodLabelSelector(template), &corev1.Pod{}, onPodUpdated)
for _, v := range template.Spec.Volumes {
if v.ConfigMap != nil {
Expand Down

0 comments on commit e9df72f

Please sign in to comment.