Skip to content

Commit

Permalink
Consistently use ObservedGeneration across our types and controllers.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor committed Feb 4, 2019
1 parent 320a5ad commit 5363ec8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/apis/autoscaling/v1alpha1/pa_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ type PodAutoscalerStatus struct {
// state of the world.
// +optional
Conditions duckv1alpha1.Conditions `json:"conditions,omitempty"`

// ObservedGeneration is the 'Generation' of the Configuration that
// was last processed by the controller. The observed generation is updated
// even if the controller failed to process the spec and create the Revision.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/networking/v1alpha1/clusteringress_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ type IngressStatus struct {
// LoadBalancer contains the current status of the load-balancer.
// +optional
LoadBalancer *LoadBalancerStatus `json:"loadBalancer,omitempty"`

// ObservedGeneration is the 'Generation' of the Configuration that
// was last processed by the controller. The observed generation is updated
// even if the controller failed to process the spec and create the Revision.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// LoadBalancerStatus represents the status of a load-balancer.
Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/v1alpha1/autoscaling/hpa/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ func (c *Reconciler) reconcile(ctx context.Context, key string, pa *pav1alpha1.P
}
}
}
pa.Status.ObservedGeneration = pa.Generation
return nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/v1alpha1/autoscaling/kpa/kpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ func (c *Reconciler) reconcile(ctx context.Context, pa *pav1alpha1.PodAutoscaler
pa.Status.MarkActive()
}

pa.Status.ObservedGeneration = pa.Generation
return nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/v1alpha1/clusteringress/clusteringress.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func (c *Reconciler) reconcile(ctx context.Context, ci *v1alpha1.ClusterIngress)
// is successfully synced.
ci.Status.MarkNetworkConfigured()
ci.Status.MarkLoadBalancerReady(getLBStatus(gatewayServiceURLFromContext(ctx, ci)))
ci.Status.ObservedGeneration = ci.Generation
logger.Info("ClusterIngress successfully synced")
return nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/v1alpha1/revision/revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ func (c *Reconciler) reconcile(ctx context.Context, rev *v1alpha1.Revision) erro
}
}

rev.Status.ObservedGeneration = rev.Generation
return nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/v1alpha1/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ func (c *Reconciler) reconcile(ctx context.Context, r *v1alpha1.Route) error {
return err
}

r.Status.ObservedGeneration = r.Generation
logger.Info("Route successfully synced")
return nil
}
Expand Down

0 comments on commit 5363ec8

Please sign in to comment.