Skip to content

Commit 3b02bba

Browse files
openshift-merge-bot[bot]gangwgr
authored andcommitted
Merge pull request #801 from liouk/fix-oidc-available-condition
OCPBUGS-65675: externaloidc: return errors when node statuses cannot be used to determine oidc state
2 parents f1d91ed + 3265312 commit 3b02bba

27 files changed

Lines changed: 799 additions & 120 deletions

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ test-e2e-oidc: GO_TEST_FLAGS += -count 1
8686
test-e2e-oidc: test-unit
8787
.PHONY: test-e2e-oidc
8888

89+
# KMS encryption tests
90+
test-e2e-encryption-kms: GO_TEST_PACKAGES :=./test/e2e-encryption-kms/...
91+
test-e2e-encryption-kms: GO_TEST_FLAGS += -v
92+
test-e2e-encryption-kms: GO_TEST_FLAGS += -timeout 4h
93+
test-e2e-encryption-kms: GO_TEST_FLAGS += -p 1
94+
test-e2e-encryption-kms: test-unit
95+
.PHONY: test-e2e-encryption-kms
96+
8997
# Configure the 'telepresence' target
9098
# See vendor/github.com/openshift/build-machinery-go/scripts/run-telepresence.sh for usage and configuration details
9199
export TP_DEPLOYMENT_YAML ?=./manifests/07_deployment.yaml

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ require (
77
github.com/ghodss/yaml v1.0.0
88
github.com/golang-jwt/jwt/v5 v5.2.2
99
github.com/google/go-cmp v0.7.0
10-
github.com/openshift/api v0.0.0-20251106190826-ebe535b08719
10+
github.com/openshift/api v0.0.0-20251111013132-5c461e21bdb7
1111
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee
1212
github.com/openshift/client-go v0.0.0-20251015124057-db0dee36e235
13-
github.com/openshift/library-go v0.0.0-20251107090138-0de9712313a5
13+
github.com/openshift/library-go v0.0.0-20260303081410-9c30edf843c6
1414
github.com/openshift/multi-operator-manager v0.0.0-20241205181422-20aa3906b99d
1515
github.com/spf13/cobra v1.9.1
1616
github.com/spf13/pflag v1.0.6

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM
147147
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
148148
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
149149
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
150-
github.com/openshift/api v0.0.0-20251106190826-ebe535b08719 h1:KEwYyKaJniwhoyLB75tAMmJn9pMlk0PUlRfrsXYOhwM=
151-
github.com/openshift/api v0.0.0-20251106190826-ebe535b08719/go.mod h1:d5uzF0YN2nQQFA0jIEWzzOZ+edmo6wzlGLvx5Fhz4uY=
150+
github.com/openshift/api v0.0.0-20251111013132-5c461e21bdb7 h1:fdvcDJySvjVJctbPbdLPoMiMk+bls34+eq6tWOqdFZg=
151+
github.com/openshift/api v0.0.0-20251111013132-5c461e21bdb7/go.mod h1:d5uzF0YN2nQQFA0jIEWzzOZ+edmo6wzlGLvx5Fhz4uY=
152152
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee h1:+Sp5GGnjHDhT/a/nQ1xdp43UscBMr7G5wxsYotyhzJ4=
153153
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee/go.mod h1:8jcm8UPtg2mCAsxfqKil1xrmRMI3a+XU2TZ9fF8A7TE=
154154
github.com/openshift/client-go v0.0.0-20251015124057-db0dee36e235 h1:9JBeIXmnHlpXTQPi7LPmu1jdxznBhAE7bb1K+3D8gxY=
155155
github.com/openshift/client-go v0.0.0-20251015124057-db0dee36e235/go.mod h1:L49W6pfrZkfOE5iC1PqEkuLkXG4W0BX4w8b+L2Bv7fM=
156-
github.com/openshift/library-go v0.0.0-20251107090138-0de9712313a5 h1:Gq8jCFgSrilZ2ZHjQleFZWlblikc1aaRZ0hqs+yvrP4=
157-
github.com/openshift/library-go v0.0.0-20251107090138-0de9712313a5/go.mod h1:OlFFws1AO51uzfc48MsStGE4SFMWlMZD0+f5a/zCtKI=
156+
github.com/openshift/library-go v0.0.0-20260303081410-9c30edf843c6 h1:9PoupWybtdTNB7bVBKac/tR5X+3IYydcTIrSyO5QR7E=
157+
github.com/openshift/library-go v0.0.0-20260303081410-9c30edf843c6/go.mod h1:ErDfiIrPHH+menTP/B4LKd0nxFDdvCbTamAc6SWMIh8=
158158
github.com/openshift/multi-operator-manager v0.0.0-20241205181422-20aa3906b99d h1:Rzx23P63JFNNz5D23ubhC0FCN5rK8CeJhKcq5QKcdyU=
159159
github.com/openshift/multi-operator-manager v0.0.0-20241205181422-20aa3906b99d/go.mod h1:iVi9Bopa5cLhjG5ie9DoZVVqkH8BGb1FQVTtecOLn4I=
160160
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=

pkg/controllers/common/external_oidc.go

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ func AuthConfigCheckerInformers[T factory.Informer](c *AuthConfigChecker) []T {
5656
// that includes the structured auth-config ConfigMap, and the KAS args include the respective
5757
// arg that enables usage of the structured auth-config. It returns false otherwise.
5858
func (c *AuthConfigChecker) OIDCAvailable() (bool, error) {
59+
if !c.authenticationsInformer.HasSynced() {
60+
return false, fmt.Errorf("AuthConfigChecker authentications informer has not synced yet")
61+
}
62+
63+
if !c.kubeAPIServersInformer.HasSynced() {
64+
return false, fmt.Errorf("AuthConfigChecker kubeapiservers informer has not synced yet")
65+
}
66+
67+
if !c.kasNamespaceConfigMapsInformer.HasSynced() {
68+
return false, fmt.Errorf("AuthConfigChecker configmaps informer has not synced yet")
69+
}
70+
5971
if auth, err := c.authLister.Get("cluster"); err != nil {
6072
return false, fmt.Errorf("getting authentications.config.openshift.io/cluster: %v", err)
6173
} else if auth.Spec.Type != configv1.AuthenticationTypeOIDC {
@@ -67,15 +79,18 @@ func (c *AuthConfigChecker) OIDCAvailable() (bool, error) {
6779
return false, fmt.Errorf("getting kubeapiservers.operator.openshift.io/cluster: %v", err)
6880
}
6981

82+
if len(kas.Status.NodeStatuses) == 0 {
83+
return false, fmt.Errorf("determining observed revisions in kubeapiservers.operator.openshift.io/cluster; no node statuses found")
84+
}
85+
7086
observedRevisions := sets.New[int32]()
7187
for _, nodeStatus := range kas.Status.NodeStatuses {
88+
if nodeStatus.CurrentRevision <= 0 {
89+
return false, fmt.Errorf("determining observed revisions in kubeapiservers.operator.openshift.io/cluster; some nodes do not have a valid CurrentRevision")
90+
}
7291
observedRevisions.Insert(nodeStatus.CurrentRevision)
7392
}
7493

75-
if observedRevisions.Len() == 0 {
76-
return false, nil
77-
}
78-
7994
for _, revision := range observedRevisions.UnsortedList() {
8095
// ensure every observed revision includes an auth-config revisioned configmap
8196
_, err := c.kasConfigMapLister.ConfigMaps("openshift-kube-apiserver").Get(fmt.Sprintf("auth-config-%d", revision))

0 commit comments

Comments
 (0)