Skip to content

Commit

Permalink
debug oidc
Browse files Browse the repository at this point in the history
Signed-off-by: Huabing Zhao <[email protected]>
  • Loading branch information
zhaohuabing committed Sep 30, 2024
1 parent 4b8c2f5 commit 5c52c50
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 67 deletions.
4 changes: 2 additions & 2 deletions internal/logging/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func (l Logger) Sugar() *zap.SugaredLogger {
return l.sugaredLogger
}

func initZapLogger(w io.Writer, logging *egv1a1.EnvoyGatewayLogging, level egv1a1.LogLevel) *zap.Logger {
parseLevel, _ := zapcore.ParseLevel(string(logging.DefaultEnvoyGatewayLoggingLevel(level)))
func initZapLogger(w io.Writer, _ *egv1a1.EnvoyGatewayLogging, _ egv1a1.LogLevel) *zap.Logger {
parseLevel, _ := zapcore.ParseLevel("debug")
core := zapcore.NewCore(zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()), zapcore.AddSync(w), zap.NewAtomicLevelAt(parseLevel))

return zap.New(core, zap.AddCaller())
Expand Down
21 changes: 0 additions & 21 deletions internal/troubleshoot/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ func CollectResult(ctx context.Context, restConfig *rest.Config, bundlePath stri
}()

collectors := []tbcollect.Collector{
// Collect the custom resources from Gateway API and EG
collect.CustomResource{
ClientConfig: restConfig,
BundlePath: bundlePath,
IncludeGroups: []string{
"gateway.envoyproxy.io",
"gateway.networking.k8s.io",
},
},
// Collect resources from EnvoyGateway system namespace
collect.EnvoyGatewayResource{
ClientConfig: restConfig,
BundlePath: bundlePath,
Namespace: egNamespace,
},
// Collect logs from EnvoyGateway system namespace
&tbcollect.CollectLogs{
Collector: &troubleshootv1b2.Logs{
Expand All @@ -55,12 +40,6 @@ func CollectResult(ctx context.Context, restConfig *rest.Config, bundlePath stri
BundlePath: bundlePath,
Context: ctx,
},
// Collect prometheus metrics from EnvoyGateway system namespace
collect.PrometheusMetric{
BundlePath: bundlePath,
ClientConfig: restConfig,
Namespace: egNamespace,
},
// Collect config dump from EnvoyGateway system namespace
collect.ConfigDump{
BundlePath: bundlePath,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestE2E(t *testing.T) {
Debug: *flags.ShowDebug,
CleanupBaseResources: *flags.CleanupBaseResources,
ManifestFS: []fs.FS{Manifests},
RunTest: *flags.RunTest,
RunTest: tests.OIDCTest.ShortName,
// SupportedFeatures cannot be empty, so we set it to SupportGateway
// All e2e tests should leave Features empty.
SupportedFeatures: sets.New[features.SupportedFeature](features.SupportGateway),
Expand Down
40 changes: 0 additions & 40 deletions test/e2e/tests/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
gwapiv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gwhttp "sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
"sigs.k8s.io/gateway-api/conformance/utils/tlog"
Expand Down Expand Up @@ -145,44 +144,5 @@ var OIDCTest = suite.ConformanceTest{
}
require.True(t, cookieDeleted, "IdToken cookie not deleted")
})

t.Run("http route without oidc authentication", func(t *testing.T) {
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "http-without-oidc", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)

ancestorRef := gwapiv1a2.ParentReference{
Group: gatewayapi.GroupPtr(gwapiv1.GroupName),
Kind: gatewayapi.KindPtr(resource.KindGateway),
Namespace: gatewayapi.NamespacePtr(gwNN.Namespace),
Name: gwapiv1.ObjectName(gwNN.Name),
}
SecurityPolicyMustBeAccepted(t, suite.Client, types.NamespacedName{Name: "oidc-test", Namespace: ns}, suite.ControllerName, ancestorRef)

podInitialized := corev1.PodCondition{Type: corev1.PodInitialized, Status: corev1.ConditionTrue}
WaitForPods(t, suite.Client, ns, map[string]string{"job-name": "setup-keycloak"}, corev1.PodSucceeded, podInitialized)

expectedResponse := gwhttp.ExpectedResponse{
Request: gwhttp.Request{
Host: "www.example.com",
Path: "/public",
},
Response: gwhttp.Response{
StatusCode: 200,
},
Namespace: ns,
}

req := gwhttp.MakeRequest(t, &expectedResponse, gwAddr, "HTTP", "http")
cReq, cResp, err := suite.RoundTripper.CaptureRoundTrip(req)
if err != nil {
t.Errorf("failed to get expected response: %v", err)
}

if err := gwhttp.CompareRequest(t, &req, cReq, cResp, expectedResponse); err != nil {
t.Errorf("failed to compare request and response: %v", err)
}
})
},
}
3 changes: 0 additions & 3 deletions tools/make/kube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ run-e2e: e2e-prepare ## Run e2e tests
@$(LOG_TARGET)
ifeq ($(E2E_RUN_TEST),)
go test $(E2E_TEST_ARGS) ./test/e2e --gateway-class=envoy-gateway --debug=true --cleanup-base-resources=false
go test $(E2E_TEST_ARGS) ./test/e2e/merge_gateways --gateway-class=merge-gateways --debug=true --cleanup-base-resources=false
go test $(E2E_TEST_ARGS) ./test/e2e/multiple_gc --debug=true --cleanup-base-resources=true
go test $(E2E_TEST_ARGS) ./test/e2e/upgrade --gateway-class=upgrade --debug=true --cleanup-base-resources=$(E2E_CLEANUP)
else
go test $(E2E_TEST_ARGS) ./test/e2e --gateway-class=envoy-gateway --debug=true --cleanup-base-resources=$(E2E_CLEANUP) \
--run-test $(E2E_RUN_TEST)
Expand Down

0 comments on commit 5c52c50

Please sign in to comment.