Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,80 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
)

// authenticationComponentProxyPostTestGrace is how long AFTER an eligible AuthenticationComponentProxy
// test ends its tolerance still applies; there is no pre-test grace. Before the tests waited for
// the oauth-openshift rollout to complete, its events were observed 2-4 minutes after the test
// ended. Now that they wait, the last DeploymentUpdated/ScalingReplicaSet occurrence lands 1-4
// minutes before the test ends and the final OperatorStatusChanged (Progressing=False) only
// seconds before, so the grace mainly absorbs Event timestamp second precision and recorder
// latency, while still covering the previously observed lag should a rollout outlive its test.
// It is a proximity allowance, not a claim the tests necessarily cause the rollouts.
const authenticationComponentProxyPostTestGrace = 5 * time.Minute

// authenticationComponentProxyScalingReplicaSetRepeatLimit bounds cumulative ScalingReplicaSet
// occurrences during eligible AuthenticationComponentProxy windows and their post-test grace.
const authenticationComponentProxyScalingReplicaSetRepeatLimit = 120

// authenticationComponentProxyEligibleTestNames are the exact, full e2e test names whose runs authorize
// the scoped oauth-openshift ScalingReplicaSet tolerance. The hot-reload test (T3) is included
const (
// authenticationPostTestGrace is how long AFTER an eligible AuthenticationComponentProxy
// test ends its tolerance still applies; there is no pre-test grace. Before the tests waited for
// the oauth-openshift rollout to complete, its events were observed 2-4 minutes after the test
// ended. Now that they wait, the last DeploymentUpdated/ScalingReplicaSet occurrence lands 1-4
// minutes before the test ends and the final OperatorStatusChanged (Progressing=False) only
// seconds before, so the grace mainly absorbs Event timestamp second precision and recorder
// latency, while still covering the previously observed lag should a rollout outlive its test.
// It is a proximity allowance, not a claim the tests necessarily cause the rollouts.
authenticationPostTestGrace = 5 * time.Minute

// authenticationComponentProxyScalingReplicaSetRepeatLimit bounds cumulative ScalingReplicaSet
// occurrences during the eligible authentication test windows and their post-test grace.
// Observed cumulative counts up to 103 within eligible proxy-test windows, so the limit
// provides bounded headroom while retaining a finite cap.
authenticationComponentProxyScalingReplicaSetRepeatLimit = 120

// authenticationComponentProxyExternalOIDCScalingReplicaSetRepeatLimit mirrors the oauth-openshift
// cap for the openshift-oauth-apiserver operand. No live run has been observed yet, so the value
// is unproven and may need retuning after the first full run.
authenticationComponentProxyExternalOIDCScalingReplicaSetRepeatLimit = 120

// authenticationOperatorDeploymentUpdatedRepeatLimit bounds cumulative DeploymentUpdated
// occurrences on the authentication-operator. Grouping all the AuthenticationComponentProxy
// tests together produced ~60 events, so the limit leaves ~15% headroom.
authenticationOperatorDeploymentUpdatedRepeatLimit = 70

// authenticationOperatorStatusChangedRepeatLimit bounds cumulative OperatorStatusChanged
// occurrences on the authentication-operator. Observed 21 times as the proxy tests complete
// rollouts, including cleanup.
authenticationOperatorStatusChangedRepeatLimit = 30
)

// authenticationComponentProxyEligibleTestNames are the exact, full e2e test names of the
// AuthenticationComponentProxy serial suite. The hot-reload test (T3) is included
// deliberately as an authorized eligible test even though it is not expected to roll the
// deployment. Matching is by exact full-name equality (never substring) so unrelated tests
// cannot widen the exception.
var authenticationComponentProxyEligibleTestNames = sets.Set[string]{}.Insert(
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] operator should validate OIDC IdP through component proxy with trustedCA`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] operator should validate OIDC IdP through component proxy`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] oauth-server/operator should hot-reload mounted CA file on change when spec.proxy.trustedCA is set`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] oauth-server should perform full OIDC login flow through the proxy when auth proxy config is applied`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] operator should fall back to original configuration on spec.proxy removal`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] oauth-server should bypass proxy by directly connecting to idp to perform OIDC login flow when spec.proxy.noProxy contains idp`,
)
func authenticationComponentProxyEligibleTestNames() sets.Set[string] {
return sets.Set[string]{}.Insert(
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] operator should validate OIDC IdP through component proxy with trustedCA`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] operator should validate OIDC IdP through component proxy`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] oauth-server/operator should hot-reload mounted CA file on change when spec.proxy.trustedCA is set`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] oauth-server should perform full OIDC login flow through the proxy when auth proxy config is applied`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] operator should fall back to original configuration on spec.proxy removal`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxy][Serial] oauth-server should bypass proxy by directly connecting to idp to perform OIDC login flow when spec.proxy.noProxy contains idp`,
)
}

// authenticationComponentProxyExternalOIDCEligibleTestNames are the exact, full e2e test names
// of the AuthenticationComponentProxyExternalOIDC serial suite. The hot-reload test is included
// deliberately as an authorized eligible test even though it is not expected to roll the
// deployment. Matching is by exact full-name equality (never substring) so unrelated tests
// cannot widen the exception.
func authenticationComponentProxyExternalOIDCEligibleTestNames() sets.Set[string] {
return sets.Set[string]{}.Insert(
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] operator should propagate proxy configuration to the oauth-apiserver operand`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] operator should propagate proxy configuration and trustedCA to the oauth-apiserver operand`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] operator should fall back to original configuration on spec.proxy removal`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] operator should go Degraded when spec.proxy.trustedCA references a missing ConfigMap`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] operator should re-sync trustedCA ConfigMap content to the oauth-apiserver operand when the source changes`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] oauth-apiserver should perform full OIDC login flow through the proxy when auth proxy config is applied`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] oauth-apiserver should perform full OIDC login flow through the HTTPS proxy with trustedCA when auth proxy config is applied`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] oauth-apiserver should perform full OIDC login flow when the proxy URL carries credentials`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] oauth-apiserver/operator should hot-reload mounted CA file on change when spec.proxy.trustedCA is set`,
`[sig-auth][Suite:openshift/conformance/serial][Jira:"Authentication"][OCPFeatureGate:AuthenticationComponentProxyExternalOIDC][Skipped:MicroShift][Serial][Slow][Disruptive] oauth-apiserver should bypass proxy by directly connecting to idp to perform OIDC login flow when spec.proxy.noProxy contains idp`,
)
}

// authenticationEligibleTestNames is the union of both authentication proxy suites' eligible
// test names. All four authentication matchers draw their allowance windows from this one set,
// so each matcher's tolerance applies during either suite's windows.
func authenticationEligibleTestNames() sets.Set[string] {
return sets.Set[string]{}.
Union(authenticationComponentProxyEligibleTestNames()).
Union(authenticationComponentProxyExternalOIDCEligibleTestNames())
}
Original file line number Diff line number Diff line change
Expand Up @@ -747,48 +747,57 @@ func NewUniversalPathologicalEventMatchers(kubeConfig *rest.Config, finalInterva
messageReasonRegex: regexp.MustCompile(`^SuccessfulCreate$`),
})

// AuthenticationComponentProxy tests intentionally trigger multiple oauth-openshift rollouts
// (set proxy → operator rolls out → restore → operator rolls out again), repeated for each
// test in the suite. This causes DeploymentUpdated, OperatorStatusChanged, and ScalingReplicaSet events in the
// authentication namespaces to exceed the default threshold of 20.
// The AuthenticationComponentProxy and AuthenticationComponentProxyExternalOIDC serial
// suites intentionally roll the authentication operator and its operands repeatedly (set
// proxy, roll out, restore, roll out again), per test, so DeploymentUpdated,
// OperatorStatusChanged, and ScalingReplicaSet events in the authentication namespaces
// exceed the default threshold of 20. The matchers share one window set built from both
// suites' eligible tests: a window opened by either suite authorizes all four matchers, and
// each matcher stays scoped to one deployment with its own cumulative cap. The operator caps
// were calibrated on the AuthenticationComponentProxy suite alone; no run has exercised them
// with both suites yet.
if windows := eligibleWindows(
finalIntervals,
authenticationComponentProxyEligibleTestNames,
authenticationComponentProxyPostTestGrace,
authenticationEligibleTestNames(),
authenticationPostTestGrace,
); len(windows) > 0 {
for _, delegate := range []*SimplePathologicalEventMatcher{
{
name: "AuthenticationComponentProxyDeploymentUpdated",
name: "AuthenticationOperatorDeploymentUpdated",
locatorKeyRegexes: map[monitorapi.LocatorKey]*regexp.Regexp{
monitorapi.LocatorNamespaceKey: regexp.MustCompile(`^openshift-authentication-operator$`),
monitorapi.LocatorDeploymentKey: regexp.MustCompile(`^authentication-operator$`),
},
messageReasonRegex: regexp.MustCompile(`^DeploymentUpdated$`),
// If all the authentication component proxy tests would be grouped together, the amount
// of events are ~60. This amount it's ~15%.
repeatThresholdOverride: 70,
messageReasonRegex: regexp.MustCompile(`^DeploymentUpdated$`),
repeatThresholdOverride: authenticationOperatorDeploymentUpdatedRepeatLimit,
},
{
name: "AuthenticationComponentProxyOperatorStatusChanged",
name: "AuthenticationOperatorStatusChanged",
locatorKeyRegexes: map[monitorapi.LocatorKey]*regexp.Regexp{
monitorapi.LocatorNamespaceKey: regexp.MustCompile(`^openshift-authentication-operator$`),
monitorapi.LocatorDeploymentKey: regexp.MustCompile(`^authentication-operator$`),
},
messageReasonRegex: regexp.MustCompile(`^OperatorStatusChanged$`),
// Observed 21 times as the proxy tests complete rollouts, including cleanup.
repeatThresholdOverride: 30,
messageReasonRegex: regexp.MustCompile(`^OperatorStatusChanged$`),
repeatThresholdOverride: authenticationOperatorStatusChangedRepeatLimit,
},
{
name: "AuthenticationComponentProxyScalingReplicaSet",
name: "AuthenticationOauthServerScalingReplicaSet",
locatorKeyRegexes: map[monitorapi.LocatorKey]*regexp.Regexp{
monitorapi.LocatorNamespaceKey: regexp.MustCompile(`^openshift-authentication$`),
monitorapi.LocatorDeploymentKey: regexp.MustCompile(`^oauth-openshift$`),
},
messageReasonRegex: regexp.MustCompile(`^ScalingReplicaSet$`),
// Observed cumulative counts up to 103 within eligible proxy-test windows.
// The 120 limit provides bounded headroom while retaining a finite cap.
messageReasonRegex: regexp.MustCompile(`^ScalingReplicaSet$`),
repeatThresholdOverride: authenticationComponentProxyScalingReplicaSetRepeatLimit,
},
{
name: "AuthenticationOauthApiserverScalingReplicaSet",
locatorKeyRegexes: map[monitorapi.LocatorKey]*regexp.Regexp{
monitorapi.LocatorNamespaceKey: regexp.MustCompile(`^openshift-oauth-apiserver$`),
monitorapi.LocatorDeploymentKey: regexp.MustCompile(`^apiserver$`),
},
messageReasonRegex: regexp.MustCompile(`^ScalingReplicaSet$`),
repeatThresholdOverride: authenticationComponentProxyExternalOIDCScalingReplicaSetRepeatLimit,
},
} {
matcher := &OverlapOtherIntervalsPathologicalEventMatcher{
delegate: delegate,
Expand Down
Loading