Skip to content

Commit 24176f6

Browse files
committed
Address PR feedback
Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
1 parent 9d597fd commit 24176f6

File tree

2 files changed

+6
-41
lines changed

2 files changed

+6
-41
lines changed

pkg/internal/testing/controlplane/apiserver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ func (s *APIServer) populateAPIServerCerts() error {
374374
return err
375375
}
376376

377-
servingAddresses := []string{"localhost", s.SecureServing.ListenAddr.Address}
378-
if s.InsecureServing != nil {
379-
servingAddresses = append(servingAddresses, s.InsecureServing.Address)
377+
servingAddresses := []string{"localhost"}
378+
if s.SecureServing.ListenAddr.Address != "" {
379+
servingAddresses = append(servingAddresses, s.SecureServing.ListenAddr.Address)
380380
}
381381

382382
servingCerts, err := ca.NewServingCert(servingAddresses...)

pkg/internal/testing/controlplane/apiserver_test.go

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,8 @@ var _ = Describe("APIServer", func() {
218218
return cert
219219
}
220220

221-
Context("when SecureServing host & port are set", func() {
222-
BeforeEach(func() {
223-
server.SecureServing = SecureServing{
224-
ListenAddr: process.ListenAddr{
225-
Address: "1.2.3.4",
226-
Port: "5678",
227-
},
228-
}
229-
})
230-
231-
It("should have the host in the certificate altnames", func() {
221+
Context("when SecureServing are not set", func() {
222+
It("should have localhost/127.0.0.1 in the certificate altnames", func() {
232223
cert := getCertificate()
233224

234225
Expect(cert.Subject.CommonName).To(Equal("localhost"))
@@ -241,39 +232,14 @@ var _ = Describe("APIServer", func() {
241232
})
242233
})
243234

244-
Context("when InsecureServing host & port are set", func() {
245-
BeforeEach(func() {
246-
server.InsecureServing = &process.ListenAddr{
247-
Address: "1.2.3.4",
248-
Port: "5678",
249-
}
250-
})
251-
252-
It("should have the host in the certificate altnames", func() {
253-
cert := getCertificate()
254-
255-
Expect(cert.Subject.CommonName).To(Equal("localhost"))
256-
Expect(cert.DNSNames).To(ConsistOf("localhost"))
257-
expectedIPAddresses := []net.IP{
258-
net.ParseIP("127.0.0.1").To4(),
259-
net.ParseIP(server.InsecureServing.Address).To4(),
260-
}
261-
Expect(cert.IPAddresses).To(ContainElements(expectedIPAddresses))
262-
})
263-
})
264-
265-
Context("when SecureServing and InsecureServing host & port are set", func() {
235+
Context("when SecureServing host & port are set", func() {
266236
BeforeEach(func() {
267237
server.SecureServing = SecureServing{
268238
ListenAddr: process.ListenAddr{
269239
Address: "1.2.3.4",
270240
Port: "5678",
271241
},
272242
}
273-
server.InsecureServing = &process.ListenAddr{
274-
Address: "5.6.7.8",
275-
Port: "1234",
276-
}
277243
})
278244

279245
It("should have the host in the certificate altnames", func() {
@@ -284,7 +250,6 @@ var _ = Describe("APIServer", func() {
284250
expectedIPAddresses := []net.IP{
285251
net.ParseIP("127.0.0.1").To4(),
286252
net.ParseIP(server.SecureServing.ListenAddr.Address).To4(),
287-
net.ParseIP(server.InsecureServing.Address).To4(),
288253
}
289254
Expect(cert.IPAddresses).To(ContainElements(expectedIPAddresses))
290255
})

0 commit comments

Comments
 (0)