Skip to content

Commit

Permalink
[k8sops] Ensure dbnodes in DNS when bootstrapping (#206)
Browse files Browse the repository at this point in the history
By default Kubernetes will not generate DNS names for a pod if it's not
ready. This sets `publishNotReadyAddresses` on the M3DB service so that
we can look up pod IPs even when they're bootstrapping (and thus send
them writes to be buffered to commitlog).
  • Loading branch information
schallert authored Mar 18, 2020
1 parent e967d23 commit 182be89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions pkg/k8sops/m3db/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ func GenerateM3DBService(cluster *myspec.M3DBCluster) (*v1.Service, error) {
Ports: generateM3DBServicePorts(cluster),
ClusterIP: v1.ClusterIPNone,
Type: v1.ServiceTypeClusterIP,
// Ensure we still publish dbnode DNS names so that we can look up nodes
// while they're bootstrapping. We don't do this for the coordinator
// service as we don't want to route unready coordinators.
PublishNotReadyAddresses: true,
},
}, nil
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/k8sops/m3db/generators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,11 @@ func TestGenerateM3DBService(t *testing.T) {
},
},
Spec: v1.ServiceSpec{
Selector: baseLabels,
Ports: generateM3DBServicePorts(cluster),
ClusterIP: v1.ClusterIPNone,
Type: v1.ServiceTypeClusterIP,
Selector: baseLabels,
Ports: generateM3DBServicePorts(cluster),
ClusterIP: v1.ClusterIPNone,
Type: v1.ServiceTypeClusterIP,
PublishNotReadyAddresses: true,
},
}

Expand Down

0 comments on commit 182be89

Please sign in to comment.