Skip to content

Commit

Permalink
fixup! common: add helper func to determine whether OIDC is enabled o…
Browse files Browse the repository at this point in the history
…n KAS pods
  • Loading branch information
liouk committed Dec 10, 2024
1 parent e4d2153 commit a1cf995
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controllers/common/external_oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func ExternalOIDCConfigAvailable(authLister configv1listers.AuthenticationLister
observedRevisions.Insert(nodeStatus.CurrentRevision)
}

if observedRevisions.Len() == 0 {
return false, nil
}

for _, revision := range observedRevisions.UnsortedList() {
// ensure every observed revision includes an auth-config revisioned configmap
_, err := cmLister.ConfigMaps("openshift-kube-apiserver").Get(fmt.Sprintf("auth-config-%d", revision))
Expand Down
6 changes: 6 additions & 0 deletions pkg/controllers/common/external_oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ func TestExternalOIDCConfigAvailable(t *testing.T) {
expectAvailable bool
expectError bool
}{
{
name: "no node statuses observed",
authType: configv1.AuthenticationTypeOIDC,
expectAvailable: false,
expectError: false,
},
{
name: "oidc disabled, no rollout",
configMaps: []*corev1.ConfigMap{cm("config-10", "config.yaml", kasConfigJSONWithoutOIDC)},
Expand Down

0 comments on commit a1cf995

Please sign in to comment.