Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1893 from dominicgunn/feature/v0.16.x-etcd-san
Browse files Browse the repository at this point in the history
[v0.16.x] Fix etcd certificates when using private zones
  • Loading branch information
dominicgunn authored Aug 18, 2020
2 parents 2260379 + 5720dae commit b06335b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions pkg/model/etcd_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ func (c EtcdCluster) DNSNames() []string {
dnsName = fmt.Sprintf("*.%s", c.region.PrivateDomainName())
}
}

privateDomainSan := fmt.Sprintf("*.%s", c.region.PrivateDomainName())
if dnsName != privateDomainSan && c.GetMemberIdentityProvider() == api.MemberIdentityProviderENI {
return []string{dnsName, privateDomainSan}
}
return []string{dnsName}
}

Expand Down
16 changes: 8 additions & 8 deletions pkg/model/etcd_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ func TestEtcdClusterDNSNames(t *testing.T) {
actual := cluster.DNSNames()
expected := []string{"*.ec2.internal"}
if !reflect.DeepEqual(actual, expected) {
t.Errorf("invalid dns names: expecetd=%v, got=%v", expected, actual)
t.Errorf("invalid dns names: expected=%v, got=%v", expected, actual)
}
})
t.Run("us-west-1", func(t *testing.T) {
cluster := NewEtcdCluster(config, usWest1, etcdNet, etcdCount)
actual := cluster.DNSNames()
expected := []string{"*.us-west-1.compute.internal"}
if !reflect.DeepEqual(actual, expected) {
t.Errorf("invalid dns names: expecetd=%v, got=%v", expected, actual)
t.Errorf("invalid dns names: expected=%v, got=%v", expected, actual)
}
})
})
Expand All @@ -42,17 +42,17 @@ func TestEtcdClusterDNSNames(t *testing.T) {
t.Run("us-east-1", func(t *testing.T) {
cluster := NewEtcdCluster(config, usEast1, etcdNet, etcdCount)
actual := cluster.DNSNames()
expected := []string{"*.internal.example.com"}
expected := []string{"*.internal.example.com", "*.ec2.internal"}
if !reflect.DeepEqual(actual, expected) {
t.Errorf("invalid dns names: expecetd=%v, got=%v", expected, actual)
t.Errorf("invalid dns names: expected=%v, got=%v", expected, actual)
}
})
t.Run("us-west-1", func(t *testing.T) {
cluster := NewEtcdCluster(config, usWest1, etcdNet, etcdCount)
actual := cluster.DNSNames()
expected := []string{"*.internal.example.com"}
expected := []string{"*.internal.example.com", "*.us-west-1.compute.internal"}
if !reflect.DeepEqual(actual, expected) {
t.Errorf("invalid dns names: expecetd=%v, got=%v", expected, actual)
t.Errorf("invalid dns names: expected=%v, got=%v", expected, actual)
}
})
})
Expand All @@ -67,15 +67,15 @@ func TestEtcdClusterDNSNames(t *testing.T) {
actual := cluster.DNSNames()
expected := []string{"*.compute-1.amazonaws.com"}
if !reflect.DeepEqual(actual, expected) {
t.Errorf("invalid dns names: expecetd=%v, got=%v", expected, actual)
t.Errorf("invalid dns names: expected=%v, got=%v", expected, actual)
}
})
t.Run("us-west-1", func(t *testing.T) {
cluster := NewEtcdCluster(config, usWest1, etcdNet, etcdCount)
actual := cluster.DNSNames()
expected := []string{"*.us-west-1.compute.amazonaws.com"}
if !reflect.DeepEqual(actual, expected) {
t.Errorf("invalid dns names: expecetd=%v, got=%v", expected, actual)
t.Errorf("invalid dns names: expected=%v, got=%v", expected, actual)
}
})
})
Expand Down

0 comments on commit b06335b

Please sign in to comment.