From 52acedda4bd1f890689d8e696aa27bda1c62e3b4 Mon Sep 17 00:00:00 2001 From: Melisa Griffin Date: Thu, 20 Jul 2023 15:33:09 -0400 Subject: [PATCH] logging help --- control-plane/api-gateway/gatekeeper/deployment.go | 2 +- control-plane/api-gateway/gatekeeper/role.go | 7 ++++++- control-plane/api-gateway/gatekeeper/service.go | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/control-plane/api-gateway/gatekeeper/deployment.go b/control-plane/api-gateway/gatekeeper/deployment.go index 3590caaf52..bd06cf0f61 100644 --- a/control-plane/api-gateway/gatekeeper/deployment.go +++ b/control-plane/api-gateway/gatekeeper/deployment.go @@ -28,7 +28,7 @@ func (g *Gatekeeper) upsertDeployment(ctx context.Context, gateway gwv1beta1.Gat // Get Deployment if it exists. existingDeployment := &appsv1.Deployment{} exists := false - + g.Log.Info("UpsertDeployment") err := g.Client.Get(ctx, g.namespacedName(gateway), existingDeployment) if err != nil && !k8serrors.IsNotFound(err) { return err diff --git a/control-plane/api-gateway/gatekeeper/role.go b/control-plane/api-gateway/gatekeeper/role.go index 1478668413..a76e593ea4 100644 --- a/control-plane/api-gateway/gatekeeper/role.go +++ b/control-plane/api-gateway/gatekeeper/role.go @@ -23,11 +23,14 @@ func (g *Gatekeeper) upsertRole(ctx context.Context, gateway gwv1beta1.Gateway, return g.deleteRole(ctx, types.NamespacedName{Namespace: gateway.Namespace, Name: gateway.Name}) } + g.Log.Info("UpsertRole") + role := &rbac.Role{} // If the Role already exists, ensure that we own the Role err := g.Client.Get(ctx, g.namespacedName(gateway), role) if err != nil && !k8serrors.IsNotFound(err) { + g.Log.Info("UpsertRole Failed") return err } else if !k8serrors.IsNotFound(err) { // Ensure we own the Role. @@ -80,6 +83,7 @@ func (g *Gatekeeper) role(gateway gwv1beta1.Gateway, gcc v1alpha1.GatewayClassCo Verbs: []string{"use"}, }) } + g.Log.Info("------------------------------------------Is Openshift Enabled?") if config.EnableOpenShift { g.Log.Info("------------------------------------------Openshift Enabled") @@ -88,7 +92,8 @@ func (g *Gatekeeper) role(gateway gwv1beta1.Gateway, gcc v1alpha1.GatewayClassCo Resources: []string{"securitycontextconstraints"}, // TODO(nathancoleman) Consider accepting an explicit SCC name. This will make the code // here less brittle and allow for the user to provide their own SCC if they wish. - ResourceNames: []string{config.ReleaseName + "-api-gateway", "gateway-*"}, + //ResourceNames: []string{config.ReleaseName + "-api-gateway"}, + ResourceNames: []string{"privileged"}, Verbs: []string{"use"}, }) } diff --git a/control-plane/api-gateway/gatekeeper/service.go b/control-plane/api-gateway/gatekeeper/service.go index d534ad50d7..60d67d2b3e 100644 --- a/control-plane/api-gateway/gatekeeper/service.go +++ b/control-plane/api-gateway/gatekeeper/service.go @@ -31,6 +31,8 @@ func (g *Gatekeeper) upsertService(ctx context.Context, gateway gwv1beta1.Gatewa return g.deleteService(ctx, types.NamespacedName{Namespace: gateway.Namespace, Name: gateway.Name}) } + g.Log.Info("UpsertService") + service := g.service(gateway, gcc) mutated := service.DeepCopy()