Skip to content

Commit 702bf57

Browse files
committed
DO-NOT-MERGE: add debug logging
1 parent 4d280bd commit 702bf57

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

pkg/controllers/common/external_oidc.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/openshift/library-go/pkg/controller/factory"
1313
corev1informers "k8s.io/client-go/informers/core/v1"
1414
"k8s.io/client-go/tools/cache"
15+
"k8s.io/klog/v2"
1516

1617
"k8s.io/apimachinery/pkg/api/errors"
1718
"k8s.io/apimachinery/pkg/util/sets"
@@ -75,6 +76,7 @@ func (c *AuthConfigChecker) OIDCAvailable() (bool, error) {
7576
nodesWithEmptyRevision := false
7677
for _, nodeStatus := range kas.Status.NodeStatuses {
7778
if nodeStatus.CurrentRevision > 0 {
79+
klog.Infof("[debug-801] node '%s' is on revision %d", nodeStatus.NodeName, nodeStatus.CurrentRevision)
7880
observedRevisions.Insert(nodeStatus.CurrentRevision)
7981
} else {
8082
nodesWithEmptyRevision = true
@@ -89,10 +91,15 @@ func (c *AuthConfigChecker) OIDCAvailable() (bool, error) {
8991
return false, fmt.Errorf("determining observed revisions in kubeapiservers.operator.openshift.io/cluster; no observed revisions found")
9092
}
9193

94+
if !c.kasNamespaceConfigMapsInformer.HasSynced() {
95+
return false, fmt.Errorf("configmaps informer has not synced yet")
96+
}
97+
9298
for _, revision := range observedRevisions.UnsortedList() {
9399
// ensure every observed revision includes an auth-config revisioned configmap
94100
_, err := c.kasConfigMapLister.ConfigMaps("openshift-kube-apiserver").Get(fmt.Sprintf("auth-config-%d", revision))
95101
if errors.IsNotFound(err) {
102+
klog.Infof("[debug-801] configmap auth-config-%d not found; informer HasSynced=%v", revision, c.kasNamespaceConfigMapsInformer.HasSynced())
96103
return false, nil
97104
} else if err != nil {
98105
return false, fmt.Errorf("getting configmap openshift-kube-apiserver/auth-config-%d: %v", revision, err)
@@ -109,6 +116,7 @@ func (c *AuthConfigChecker) OIDCAvailable() (bool, error) {
109116
if !strings.Contains(cm.Data["config.yaml"], `"oauthMetadataFile":""`) ||
110117
strings.Contains(cm.Data["config.yaml"], `"authentication-token-webhook-config-file":`) ||
111118
!strings.Contains(cm.Data["config.yaml"], `"authentication-config":["/etc/kubernetes/static-pod-resources/configmaps/auth-config/auth-config.json"]`) {
119+
klog.Infof("[debug-801] configmap config-%d does not contain expected OIDC config", revision)
112120
return false, nil
113121
}
114122
}

pkg/libs/endpointaccessible/endpoint_accessible_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
apierrors "k8s.io/apimachinery/pkg/api/errors"
1313
utilerrors "k8s.io/apimachinery/pkg/util/errors"
1414
"k8s.io/apimachinery/pkg/util/wait"
15+
"k8s.io/klog/v2"
1516

1617
operatorv1 "github.com/openshift/api/operator/v1"
1718
applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1"
@@ -78,14 +79,20 @@ func humanizeError(err error) error {
7879

7980
func (c *endpointAccessibleController) sync(ctx context.Context, syncCtx factory.SyncContext) error {
8081
if c.endpointCheckDisabledFunc != nil {
82+
klog.Infof("[debug-801] found non-nil endpointCheckDisabledFunc")
8183
if skip, err := c.endpointCheckDisabledFunc(); err != nil {
84+
klog.Errorf("[debug-801] endpointCheckDisabledFunc returned an error: %v", err)
8285
return err
8386
} else if skip {
8487
// Server-Side-Apply with an empty operator status for the specific field manager
8588
// will effectively remove any conditions owned by it since the list type in the
8689
// API definition is 'map'
90+
klog.Infof("[debug-801] endpointCheckDisabledFunc returned true; skipping endpoint check")
8791
return c.operatorClient.ApplyOperatorStatus(ctx, c.controllerInstanceName, applyoperatorv1.OperatorStatus())
8892
}
93+
klog.Infof("[debug-801] endpointCheckDisabledFunc returned false; will not skip endpoint check")
94+
} else {
95+
klog.Infof("[debug-801] endpointCheckDisabledFunc is nil; will not skip endpoint check")
8996
}
9097

9198
endpoints, err := c.endpointListFn()

0 commit comments

Comments
 (0)