Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1064 from weaveworks/issue/1062-npe-statefulset
Browse files Browse the repository at this point in the history
Avoid NPE while dereferencing statefulset status
  • Loading branch information
squaremo authored May 4, 2018
2 parents d07783f + 52a7688 commit cb31f1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cluster/kubernetes/resourcekinds.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ func (dk *statefulSetKind) getPodControllers(c *Cluster, namespace string) ([]po
func makeStatefulSetPodController(statefulSet *apiapps.StatefulSet) podController {
var status string
objectMeta, statefulSetStatus := statefulSet.ObjectMeta, statefulSet.Status
if *statefulSetStatus.ObservedGeneration >= objectMeta.Generation {
// The type of ObservedGeneration is *int64, unlike other controllers.
if statefulSetStatus.ObservedGeneration != nil && *statefulSetStatus.ObservedGeneration >= objectMeta.Generation {
// the definition has been updated; now let's see about the replicas
updated, wanted := statefulSetStatus.UpdatedReplicas, *statefulSet.Spec.Replicas
if updated == wanted {
Expand Down

0 comments on commit cb31f1a

Please sign in to comment.