mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 05:45:46 +00:00
a72f868218
This updates the testing/deployer (aka "topology test") framework to conditionally configure and launch catalog constructs using v2 resources. This is controlled via a Version field on the Node construct in a topology.Config. This only functions for a dataplane type and has other restrictions that match the rest of v2 (no peering, no wanfed, no mesh gateways). Like config entries, you can statically provide a set of initial resources to be synced when bringing up the cluster (beyond those that are generated for you such as workloads, services, etc). If you want to author a test that can be freely converted between v1 and v2 then that is possible. If you switch to the multi-port definition on a topology.Service (aka "workload/instance") then that makes v1 ineligible. This also adds a starter set of "on every PR" integration tests for single and multiport under test-integ/catalogv2
43 lines
982 B
Go
43 lines
982 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package sprawl
|
|
|
|
import (
|
|
"context"
|
|
"crypto/tls"
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/go-rootcerts"
|
|
"google.golang.org/grpc"
|
|
|
|
"github.com/hashicorp/consul/testing/deployer/sprawl/internal/secrets"
|
|
"github.com/hashicorp/consul/testing/deployer/topology"
|
|
"github.com/hashicorp/consul/testing/deployer/util"
|
|
)
|
|
|
|
func (s *Sprawl) dialServerGRPC(cluster *topology.Cluster, node *topology.Node, token string) (*grpc.ClientConn, func(), error) {
|
|
var (
|
|
logger = s.logger.With("cluster", cluster.Name)
|
|
)
|
|
|
|
tls := &tls.Config{
|
|
ServerName: fmt.Sprintf("server.%s.consul", cluster.Datacenter),
|
|
}
|
|
|
|
rootConfig := &rootcerts.Config{
|
|
CACertificate: []byte(s.secrets.ReadGeneric(cluster.Name, secrets.CAPEM)),
|
|
}
|
|
if err := rootcerts.ConfigureTLS(tls, rootConfig); err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
return util.DialExposedGRPCConn(
|
|
context.Background(),
|
|
logger,
|
|
node.ExposedPort(8503),
|
|
token,
|
|
tls,
|
|
)
|
|
}
|