Skip to content

Commit

Permalink
tmp: additional debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rainest committed Feb 15, 2022
1 parent cf642b8 commit a1dfdee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/admission/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io"
"net/http"
"os/exec"

"github.com/sirupsen/logrus"
admission "k8s.io/api/admission/v1"
Expand Down Expand Up @@ -112,6 +113,10 @@ type RequestHandler struct {
// ServeHTTP parses AdmissionReview requests and responds back
// with the validation result of the entity.
func (a RequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
cmd := exec.Command("ls", "-l", "/admission-webhook/")
out, err := cmd.Output()
a.Logger.Warnf("certificate dir status: %s", out)
a.Logger.Warnf("certificate dir err: %s", err)
if r.Body == nil {
a.Logger.Error("received request with empty body")
http.Error(w, "admission review object is missing",
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package e2e
import (
"context"
"crypto/tls"
"fmt"
"net/http"
"testing"
"time"

Expand Down Expand Up @@ -208,8 +210,12 @@ func TestWebhookUpdate(t *testing.T) {
conn, err := tls.Dial("tcp", admissionAddress+":443",
&tls.Config{MinVersion: tls.VersionTLS13, InsecureSkipVerify: true}) // nolint:gosec
if err != nil {
t.Logf("could not connect: %s", err)
return false
}
t.Logf("observed certificate: %s", conn.ConnectionState().PeerCertificates[0].Subject.CommonName)
httpc := http.Client{Timeout: time.Second * 10}
_, _ = httpc.Get(fmt.Sprintf("http://%s/", admissionAddress+":443"))
return conn.ConnectionState().PeerCertificates[0].Subject.CommonName == "second.example"
}, time.Minute*8, time.Second)
}
Expand Down

0 comments on commit a1dfdee

Please sign in to comment.