Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
107415: roachprod: add GCE DNS Provider r=renatolabs a=herkolategan

Previously on PR cockroachdb#106497 an interface for DNS record management to extend
provider capabilities was introduced, as well as a local cluster only
implementation of that interface, to support port management of tenants in the
form of services.

This change adds a Google Cloud DNS implementation for the GCE Provider
utilising the same interface as mentioned above, to enable cloud clusters to
also utilise port management for tenants. It uses the commands available on the
`gcloud dns cli` to perform DNS operations required to register cockroach
services. All operational commands run through `gcloud` except for
`LookupSRVRecords` which relies on the standard `net` package.

`roachprod` operations are likely to invoke the lookup call frequently thus
using the standard net lookup yields better performance than going through the
`cli`. There is a small delay between management operations completing and the
records becoming available through standard lookup methods. A wait function is
provided to ensure all the records are available through a standard net lookup
after a create operation.

This implementation opted for the non-transactional gcloud dns cli. The
transaction operations are not allowed to overlap even if managing separate
records. A transaction will result in a "preconditions not met" error if any
other transaction completed on the same zone while this one is still in flight.
Due to the fact that `roachprod` can be used from various places concurrently
it's best to avoid this.

Epic: [CRDB-18499](https://cockroachlabs.atlassian.net/browse/CRDB-18499)
Release note: None

109844: sql: fix system database survival on create or drop database r=JeffSwenson a=JeffSwenson

Run the system database region survival promotion/demotion logic when creating or dropping databases. This fixes a bug where creating a database that survives region failures would not promote the system database to survive region.

This logic is temporary and should be removed once RFC cockroachdb#109843 allows us to configure the system database as a mix of survive zone and survive region.

Fixes: cockroachdb#109843

110527: build: upgrade cockroachdb/apd to v3.2.1 r=miretskiy a=otan

Release note (general change, bug fix): Fixed a bug where, internally,
if we print a 0 decimal with a very low exponent we use excessive
memory. This is not possible through using the decimal type, but may be
possible through crdb_internal functions.



Epic: none

Co-authored-by: Herko Lategan <[email protected]>
Co-authored-by: Jeff <[email protected]>
Co-authored-by: Oliver Tan <[email protected]>
  • Loading branch information
4 people committed Sep 13, 2023
4 parents 81313b8 + 925fd89 + 9b5991d + 4130056 commit 00cbb30
Show file tree
Hide file tree
Showing 29 changed files with 418 additions and 66 deletions.
6 changes: 3 additions & 3 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1496,10 +1496,10 @@ def go_deps():
name = "com_github_cockroachdb_apd_v3",
build_file_proto_mode = "disable_global",
importpath = "github.com/cockroachdb/apd/v3",
sha256 = "c1282ae1d20d7657662b315db68e370a210c511080368cd4490946d44c4c68b1",
strip_prefix = "github.com/cockroachdb/apd/[email protected].0",
sha256 = "6ad54bb71a36fba8ca6725a00d916e51815a4c68de54096313ca6fffda6c87c2",
strip_prefix = "github.com/cockroachdb/apd/[email protected].1",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/apd/v3/com_github_cockroachdb_apd_v3-v3.2.0.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/apd/v3/com_github_cockroachdb_apd_v3-v3.2.1.zip",
],
)
go_repository(
Expand Down
2 changes: 1 addition & 1 deletion build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cncf/udpa/go/com_github_cncf_udpa_go-v0.0.0-20220112060539-c52dc94e7fbe.zip": "8fe1585f25d40a5e3cd4243a92143d71ae4ee92e915e7192e72387047539438e",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cncf/xds/go/com_github_cncf_xds_go-v0.0.0-20230105202645-06c439db220b.zip": "7e33dbf929da89661e8f7507706f7ea28762d7c48c899d8e8352145c11627bf4",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/apd/com_github_cockroachdb_apd-v1.1.0.zip": "fef7ec2fae220f84bfacb17fbfc1b04a666ab7f6fc04f3ff6d2b1e05c380777d",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/apd/v3/com_github_cockroachdb_apd_v3-v3.2.0.zip": "c1282ae1d20d7657662b315db68e370a210c511080368cd4490946d44c4c68b1",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/apd/v3/com_github_cockroachdb_apd_v3-v3.2.1.zip": "6ad54bb71a36fba8ca6725a00d916e51815a4c68de54096313ca6fffda6c87c2",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/bubbletea/com_github_cockroachdb_bubbletea-v0.23.1-bracketed-paste2.zip": "d7916a0e7d8d814566e8f8d162c3764aea947296396a0a669564ff3ee53414bc",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/circuitbreaker/com_github_cockroachdb_circuitbreaker-v2.2.2-0.20190114160014-a614b14ccf63+incompatible.zip": "52fdb5ba6a60e9a2f1db42d5b3c4c13cc5bb3947d5ce7f1bba9b0a14de71813a",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/cmux/com_github_cockroachdb_cmux-v0.0.0-20170110192607-30d10be49292.zip": "88f6f9cf33eb535658540b46f6222f029398e590a3ff9cc873d7d561ac6debf0",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/charmbracelet/bubbles v0.15.1-0.20230123181021-a6a12c4a31eb
github.com/client9/misspell v0.3.4
github.com/cockroachdb/apd/v3 v3.2.0
github.com/cockroachdb/apd/v3 v3.2.1
github.com/cockroachdb/circuitbreaker v2.2.2-0.20190114160014-a614b14ccf63+incompatible
github.com/cockroachdb/cmux v0.0.0-20170110192607-30d10be49292
github.com/cockroachdb/cockroach-go/v2 v2.3.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/cockroachdb/apd/v3 v3.2.0 h1:79kHCn4tO0VGu3W0WujYrMjBDk8a2H4KEUYcXf7whcg=
github.com/cockroachdb/apd/v3 v3.2.0/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
github.com/cockroachdb/bubbletea v0.23.1-bracketed-paste2 h1:OmQDBlTg1DU5OaKjIuEBt4K+40i9RqtxAwK1P/0OVjI=
github.com/cockroachdb/bubbletea v0.23.1-bracketed-paste2/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61BjWTQY57RbT25aMXU=
github.com/cockroachdb/circuitbreaker v2.2.2-0.20190114160014-a614b14ccf63+incompatible h1:u3uQ4oAKM5g2eODBAsDdDSrTs7zRWXtvu+nvSDA9098=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AS $$
name,
survival_goal
FROM crdb_internal.databases
WHERE name IN ('system', 'alter_survive_db', 'survive_zone_db')
WHERE name IN ('system', 'alter_survive_db', 'create_survive_db', 'survive_zone_db')
ORDER BY name;
$$;

Expand Down Expand Up @@ -81,6 +81,29 @@ SELECT get_db_survival_goal()
(survive_zone_db,zone)
(system,zone)

# Make sure a database created with a surival goal upgrades the systemdb.
statement ok
CREATE DATABASE create_survive_db PRIMARY REGION "us-east-1" REGIONS "ap-southeast-2", "ca-central-1" SURVIVE REGION FAILURE;

query T nosort
SELECT get_db_survival_goal()
----
(alter_survive_db,zone)
(create_survive_db,region)
(survive_zone_db,zone)
(system,region)

# Make sure dropping the database downgrades the survival goal.
statement ok
DROP DATABASE create_survive_db;

query T nosort
SELECT get_db_survival_goal()
----
(alter_survive_db,zone)
(survive_zone_db,zone)
(system,zone)

statement ok
ALTER DATABASE system SURVIVE REGION FAILURE;

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachprod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ var adminurlCmd = &cobra.Command{
Args: cobra.ExactArgs(1),
Run: wrap(func(cmd *cobra.Command, args []string) error {
urls, err := roachprod.AdminURL(
config.Logger, args[0], tenantName, tenantInstance, adminurlPath, adminurlIPs, adminurlOpen, secure,
context.Background(), config.Logger, args[0], tenantName, tenantInstance, adminurlPath, adminurlIPs, adminurlOpen, secure,
)
if err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions pkg/cmd/roachtest/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2373,24 +2373,24 @@ func addrToHostPort(addr string) (string, int, error) {
// InternalAdminUIAddr returns the internal Admin UI address in the form host:port
// for the specified node.
func (c *clusterImpl) InternalAdminUIAddr(
_ context.Context, l *logger.Logger, node option.NodeListOption,
ctx context.Context, l *logger.Logger, node option.NodeListOption,
) ([]string, error) {
return c.adminUIAddr(l, node, false)
return c.adminUIAddr(ctx, l, node, false)
}

// ExternalAdminUIAddr returns the external Admin UI address in the form host:port
// for the specified node.
func (c *clusterImpl) ExternalAdminUIAddr(
_ context.Context, l *logger.Logger, node option.NodeListOption,
ctx context.Context, l *logger.Logger, node option.NodeListOption,
) ([]string, error) {
return c.adminUIAddr(l, node, true)
return c.adminUIAddr(ctx, l, node, true)
}

func (c *clusterImpl) adminUIAddr(
l *logger.Logger, node option.NodeListOption, external bool,
ctx context.Context, l *logger.Logger, node option.NodeListOption, external bool,
) ([]string, error) {
var addrs []string
adminURLs, err := roachprod.AdminURL(l, c.MakeNodes(node), "", 0, "",
adminURLs, err := roachprod.AdminURL(ctx, l, c.MakeNodes(node), "", 0, "",
external, false, false)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ func (c *SyncedCluster) Monitor(
defer wg.Done()

node := nodes[i]
port, err := c.NodePort(node)
port, err := c.NodePort(ctx, node)
if err != nil {
err := errors.Wrap(err, "failed to get node port")
sendEvent(NodeMonitorInfo{Node: node, Event: MonitorError{err}})
Expand Down Expand Up @@ -2366,7 +2366,7 @@ func (c *SyncedCluster) pgurls(
}
m := make(map[Node]string, len(hosts))
for node, host := range hosts {
desc, err := c.DiscoverService(node, tenantName, ServiceTypeSQL, tenantInstance)
desc, err := c.DiscoverService(ctx, node, tenantName, ServiceTypeSQL, tenantInstance)
if err != nil {
return nil, err
}
Expand Down
40 changes: 21 additions & 19 deletions pkg/roachprod/install/cockroach.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (so StartOpts) GetJoinTargets() []Node {
func (c *SyncedCluster) maybeRegisterServices(
ctx context.Context, l *logger.Logger, startOpts StartOpts,
) error {
serviceMap, err := c.MapServices(startOpts.TenantName, startOpts.TenantInstance)
serviceMap, err := c.MapServices(ctx, startOpts.TenantName, startOpts.TenantInstance)
if err != nil {
return err
}
Expand Down Expand Up @@ -256,7 +256,7 @@ func (c *SyncedCluster) maybeRegisterServices(
if err != nil {
return err
}
return c.RegisterServices(servicesToRegister)
return c.RegisterServices(ctx, servicesToRegister)
}

// Start the cockroach process on the cluster.
Expand Down Expand Up @@ -421,17 +421,17 @@ func (c *SyncedCluster) NodeURL(host string, port int, sharedTenantName string)
}

// NodePort returns the system tenant's SQL port for the given node.
func (c *SyncedCluster) NodePort(node Node) (int, error) {
desc, err := c.DiscoverService(node, SystemTenantName, ServiceTypeSQL, 0)
func (c *SyncedCluster) NodePort(ctx context.Context, node Node) (int, error) {
desc, err := c.DiscoverService(ctx, node, SystemTenantName, ServiceTypeSQL, 0)
if err != nil {
return 0, err
}
return desc.Port, nil
}

// NodeUIPort returns the system tenant's AdminUI port for the given node.
func (c *SyncedCluster) NodeUIPort(node Node) (int, error) {
desc, err := c.DiscoverService(node, SystemTenantName, ServiceTypeUI, 0)
func (c *SyncedCluster) NodeUIPort(ctx context.Context, node Node) (int, error) {
desc, err := c.DiscoverService(ctx, node, SystemTenantName, ServiceTypeUI, 0)
if err != nil {
return 0, err
}
Expand All @@ -450,7 +450,7 @@ func (c *SyncedCluster) ExecOrInteractiveSQL(
if len(c.Nodes) != 1 {
return fmt.Errorf("invalid number of nodes for interactive sql: %d", len(c.Nodes))
}
desc, err := c.DiscoverService(c.Nodes[0], tenantName, ServiceTypeSQL, tenantInstance)
desc, err := c.DiscoverService(ctx, c.Nodes[0], tenantName, ServiceTypeSQL, tenantInstance)
if err != nil {
return err
}
Expand Down Expand Up @@ -480,7 +480,7 @@ func (c *SyncedCluster) ExecSQL(
) error {
display := fmt.Sprintf("%s: executing sql", c.Name)
results, _, err := c.ParallelE(ctx, l, nodes, func(ctx context.Context, node Node) (*RunResultDetails, error) {
desc, err := c.DiscoverService(node, tenantName, ServiceTypeSQL, tenantInstance)
desc, err := c.DiscoverService(ctx, node, tenantName, ServiceTypeSQL, tenantInstance)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -649,7 +649,7 @@ func (c *SyncedCluster) generateStartArgs(
instance := startOpts.TenantInstance
var sqlPort int
if startOpts.Target == StartTenantSQL {
desc, err := c.DiscoverService(node, tenantName, ServiceTypeSQL, instance)
desc, err := c.DiscoverService(ctx, node, tenantName, ServiceTypeSQL, instance)
if err != nil {
return nil, err
}
Expand All @@ -659,14 +659,14 @@ func (c *SyncedCluster) generateStartArgs(
tenantName = SystemTenantName
// System tenant instance is always 0.
instance = 0
desc, err := c.DiscoverService(node, tenantName, ServiceTypeSQL, instance)
desc, err := c.DiscoverService(ctx, node, tenantName, ServiceTypeSQL, instance)
if err != nil {
return nil, err
}
sqlPort = desc.Port
args = append(args, fmt.Sprintf("--listen-addr=%s:%d", listenHost, sqlPort))
}
desc, err := c.DiscoverService(node, tenantName, ServiceTypeUI, instance)
desc, err := c.DiscoverService(ctx, node, tenantName, ServiceTypeUI, instance)
if err != nil {
return nil, err
}
Expand All @@ -689,7 +689,7 @@ func (c *SyncedCluster) generateStartArgs(
joinTargets := startOpts.GetJoinTargets()
addresses := make([]string, len(joinTargets))
for i, joinNode := range startOpts.GetJoinTargets() {
desc, err := c.DiscoverService(joinNode, SystemTenantName, ServiceTypeSQL, 0)
desc, err := c.DiscoverService(ctx, joinNode, SystemTenantName, ServiceTypeSQL, 0)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -803,7 +803,7 @@ func (c *SyncedCluster) initializeCluster(
ctx context.Context, l *logger.Logger, node Node,
) (*RunResultDetails, error) {
l.Printf("%s: initializing cluster\n", c.Name)
cmd, err := c.generateInitCmd(node)
cmd, err := c.generateInitCmd(ctx, node)
if err != nil {
return nil, err
}
Expand All @@ -822,7 +822,7 @@ func (c *SyncedCluster) setClusterSettings(
ctx context.Context, l *logger.Logger, node Node,
) (*RunResultDetails, error) {
l.Printf("%s: setting cluster settings", c.Name)
cmd, err := c.generateClusterSettingCmd(l, node)
cmd, err := c.generateClusterSettingCmd(ctx, l, node)
if err != nil {
return nil, err
}
Expand All @@ -837,7 +837,9 @@ func (c *SyncedCluster) setClusterSettings(
return res, err
}

func (c *SyncedCluster) generateClusterSettingCmd(l *logger.Logger, node Node) (string, error) {
func (c *SyncedCluster) generateClusterSettingCmd(
ctx context.Context, l *logger.Logger, node Node,
) (string, error) {
if config.CockroachDevLicense == "" {
l.Printf("%s: COCKROACH_DEV_LICENSE unset: enterprise features will be unavailable\n",
c.Name)
Expand All @@ -862,7 +864,7 @@ func (c *SyncedCluster) generateClusterSettingCmd(l *logger.Logger, node Node) (

binary := cockroachNodeBinary(c, node)
path := fmt.Sprintf("%s/%s", c.NodeDir(node, 1 /* storeIndex */), "settings-initialized")
port, err := c.NodePort(node)
port, err := c.NodePort(ctx, node)
if err != nil {
return "", err
}
Expand All @@ -875,14 +877,14 @@ func (c *SyncedCluster) generateClusterSettingCmd(l *logger.Logger, node Node) (
return clusterSettingsCmd, nil
}

func (c *SyncedCluster) generateInitCmd(node Node) (string, error) {
func (c *SyncedCluster) generateInitCmd(ctx context.Context, node Node) (string, error) {
var initCmd string
if c.IsLocal() {
initCmd = fmt.Sprintf(`cd %s ; `, c.localVMDir(node))
}

path := fmt.Sprintf("%s/%s", c.NodeDir(node, 1 /* storeIndex */), "cluster-bootstrapped")
port, err := c.NodePort(node)
port, err := c.NodePort(ctx, node)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -1008,7 +1010,7 @@ func (c *SyncedCluster) createFixedBackupSchedule(

node := c.Nodes[0]
binary := cockroachNodeBinary(c, node)
port, err := c.NodePort(node)
port, err := c.NodePort(ctx, node)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/roachprod/install/expander.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (e *expander) maybeExpandPgPort(
if e.pgPorts == nil {
e.pgPorts = make(map[Node]string, len(c.VMs))
for _, node := range allNodes(len(c.VMs)) {
desc, err := c.DiscoverService(node, tenantName, ServiceTypeSQL, tenantInstance)
desc, err := c.DiscoverService(ctx, node, tenantName, ServiceTypeSQL, tenantInstance)
if err != nil {
return s, false, err
}
Expand All @@ -229,7 +229,7 @@ func (e *expander) maybeExpandUIPort(
e.uiPorts = make(map[Node]string, len(c.VMs))
for _, node := range allNodes(len(c.VMs)) {
// TODO(herko): Add support for external tenants.
e.uiPorts[node] = fmt.Sprint(c.NodeUIPort(node))
e.uiPorts[node] = fmt.Sprint(c.NodeUIPort(ctx, node))
}
}

Expand Down
22 changes: 12 additions & 10 deletions pkg/roachprod/install/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func serviceNameComponents(name string) (string, ServiceType, error) {
// the given parameters if instances of the same tenant and type are running on
// any of the nodes.
func (c *SyncedCluster) DiscoverServices(
tenantName string, serviceType ServiceType, predicates ...ServicePredicate,
ctx context.Context, tenantName string, serviceType ServiceType, predicates ...ServicePredicate,
) (ServiceDescriptors, error) {
// If no tenant name is specified, use the system tenant.
if tenantName == "" {
Expand All @@ -138,7 +138,7 @@ func (c *SyncedCluster) DiscoverServices(
records := make([]vm.DNSRecord, 0)
err := vm.FanOutDNS(c.VMs, func(dnsProvider vm.DNSProvider, _ vm.List) error {
service := fmt.Sprintf("%s-%s", tenantName, string(serviceType))
r, lookupErr := dnsProvider.LookupSRVRecords(service, "tcp", c.Name)
r, lookupErr := dnsProvider.LookupSRVRecords(ctx, service, "tcp", c.Name)
if lookupErr != nil {
return lookupErr
}
Expand All @@ -161,10 +161,10 @@ func (c *SyncedCluster) DiscoverServices(
// no services are found, it returns a service descriptor with the default port
// for the service type.
func (c *SyncedCluster) DiscoverService(
node Node, tenantName string, serviceType ServiceType, tenantInstance int,
ctx context.Context, node Node, tenantName string, serviceType ServiceType, tenantInstance int,
) (ServiceDesc, error) {
services, err := c.DiscoverServices(
tenantName, serviceType, ServiceNodePredicate(node), ServiceInstancePredicate(tenantInstance),
ctx, tenantName, serviceType, ServiceNodePredicate(node), ServiceInstancePredicate(tenantInstance),
)
if err != nil {
return ServiceDesc{}, err
Expand All @@ -173,7 +173,7 @@ func (c *SyncedCluster) DiscoverService(
// service for the system tenant, and assume the service is shared.
if len(services) == 0 {
services, err = c.DiscoverServices(
SystemTenantName, serviceType, ServiceNodePredicate(node),
ctx, SystemTenantName, serviceType, ServiceNodePredicate(node),
)
if err != nil {
return ServiceDesc{}, err
Expand Down Expand Up @@ -207,14 +207,16 @@ func (c *SyncedCluster) DiscoverService(

// MapServices discovers all service types for a given tenant and instance and
// maps it by node and service type
func (c *SyncedCluster) MapServices(tenantName string, instance int) (NodeServiceMap, error) {
func (c *SyncedCluster) MapServices(
ctx context.Context, tenantName string, instance int,
) (NodeServiceMap, error) {
nodeFilter := ServiceNodePredicate(c.Nodes...)
instanceFilter := ServiceInstancePredicate(instance)
sqlServices, err := c.DiscoverServices(tenantName, ServiceTypeSQL, nodeFilter, instanceFilter)
sqlServices, err := c.DiscoverServices(ctx, tenantName, ServiceTypeSQL, nodeFilter, instanceFilter)
if err != nil {
return nil, err
}
uiServices, err := c.DiscoverServices(tenantName, ServiceTypeUI, nodeFilter, instanceFilter)
uiServices, err := c.DiscoverServices(ctx, tenantName, ServiceTypeUI, nodeFilter, instanceFilter)
if err != nil {
return nil, err
}
Expand All @@ -232,7 +234,7 @@ func (c *SyncedCluster) MapServices(tenantName string, instance int) (NodeServic
// RegisterServices registers services with the DNS provider. This function is
// lenient and will not return an error if no DNS provider is available to
// register the service.
func (c *SyncedCluster) RegisterServices(services ServiceDescriptors) error {
func (c *SyncedCluster) RegisterServices(ctx context.Context, services ServiceDescriptors) error {
servicesByDNSProvider := make(map[string]ServiceDescriptors)
for _, desc := range services {
dnsProvider := c.VMs[desc.Node-1].DNSProvider
Expand All @@ -258,7 +260,7 @@ func (c *SyncedCluster) RegisterServices(services ServiceDescriptors) error {
}
records = append(records, vm.CreateSRVRecord(name, srvData))
}
err := dnsProvider.CreateRecords(records...)
err := dnsProvider.CreateRecords(ctx, records...)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 00cbb30

Please sign in to comment.