Skip to content

Commit

Permalink
systemtest: don't use fleet-server IP (#7157) (#7158)
Browse files Browse the repository at this point in the history
I don't recall why we were using the IP for fleet-server
in the first place, but should be able to rely on the
container's hostname being resolvable, and it allows us
to verify TLS without relying on IP SANs.

(cherry picked from commit d57b999)

Co-authored-by: Andrew Wilkins <[email protected]>
  • Loading branch information
mergify[bot] and axw authored Feb 2, 2022
1 parent 1b89438 commit 238e487
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions systemtest/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ import (

const (
startContainersTimeout = 5 * time.Minute

fleetServerPort = "8220"
)

var (
Expand Down Expand Up @@ -314,17 +312,9 @@ func NewUnstartedElasticAgentContainer() (*ElasticAgentContainer, error) {
return nil, err
}

var fleetServerIPAddress string
var networks []string
for network, settings := range fleetServerContainerDetails.NetworkSettings.Networks {
for network := range fleetServerContainerDetails.NetworkSettings.Networks {
networks = append(networks, network)
if fleetServerIPAddress == "" && settings.IPAddress != "" {
fleetServerIPAddress = settings.IPAddress
}
}
fleetServerURL := &url.URL{
Scheme: "https",
Host: net.JoinHostPort(fleetServerIPAddress, fleetServerPort),
}
containerCACertPath := "/etc/pki/tls/certs/fleet-ca.pem"

Expand Down Expand Up @@ -360,7 +350,7 @@ func NewUnstartedElasticAgentContainer() (*ElasticAgentContainer, error) {
Networks: networks,
BindMounts: map[string]string{hostCACertPath: containerCACertPath},
Env: map[string]string{
"FLEET_URL": fleetServerURL.String(),
"FLEET_URL": "https://fleet-server:8220",
"FLEET_CA": containerCACertPath,
},
SkipReaper: true, // we use our own reaping logic
Expand Down

0 comments on commit 238e487

Please sign in to comment.