77
88 g "github.com/onsi/ginkgo/v2"
99 o "github.com/onsi/gomega"
10+ configv1 "github.com/openshift/api/config/v1"
1011 operatorv1 "github.com/openshift/api/operator/v1"
1112 "github.com/openshift/library-go/pkg/operator/v1helpers"
1213 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -18,64 +19,84 @@ import (
1819 exutil "github.com/openshift/origin/test/extended/util"
1920)
2021
22+ type runtimeConfigConditionsFunc func (context.Context , * exutil.CLI ) ([]string , error )
23+
2124var (
25+ // some conditions depend on cluster runtime configuration
26+ operatorResourceToConditionalConditions = map [schema.GroupVersionResource ]runtimeConfigConditionsFunc {
27+ {Group : "operator.openshift.io" , Version : "v1" , Resource : "authentications" }: func (ctx context.Context , oc * exutil.CLI ) ([]string , error ) {
28+ authn , err := oc .AdminConfigClient ().ConfigV1 ().Authentications ().Get (ctx , "cluster" , metav1.GetOptions {})
29+ if err != nil {
30+ return nil , err
31+ }
32+
33+ switch authn .Spec .Type {
34+ case configv1 .AuthenticationTypeOIDC :
35+ return nil , nil
36+
37+ default :
38+ return []string {
39+ "APIServerDeploymentAvailable" ,
40+ "APIServerDeploymentDegraded" ,
41+ "APIServerDeploymentProgressing" ,
42+ "AuthConfigDegraded" ,
43+ "AuthenticatorCertKeyProgressing" ,
44+ "IngressConfigDegraded" ,
45+ "IngressStateEndpointsDegraded" ,
46+ "IngressStatePodsDegraded" ,
47+ "OAuthConfigDegraded" ,
48+ "OAuthConfigIngressDegraded" ,
49+ "OAuthConfigRouteDegraded" ,
50+ "OAuthConfigServiceDegraded" ,
51+ "OAuthServerDeploymentAvailable" ,
52+ "OAuthServerDeploymentDegraded" ,
53+ "OAuthServerDeploymentProgressing" ,
54+ "OAuthServerRouteEndpointAccessibleControllerAvailable" ,
55+ "OAuthServerServiceEndpointAccessibleControllerAvailable" ,
56+ "OAuthServerServiceEndpointsEndpointAccessibleControllerAvailable" ,
57+ "OAuthServiceDegraded" ,
58+ "OAuthSessionSecretDegraded" ,
59+ "OAuthSystemMetadataDegraded" ,
60+ "ReadyIngressNodesAvailable" ,
61+ "RouterCertsDegraded" ,
62+ "SystemServiceCAConfigDegraded" ,
63+ "WellKnownAvailable" ,
64+ "WellKnownReadyControllerProgressing" ,
65+ }, nil
66+ }
67+ },
68+ }
2269 operatorResourceToRequiredConditions = map [schema.GroupVersionResource ][]string {
2370 {Group : "operator.openshift.io" , Version : "v1" , Resource : "authentications" }: {
24- "APIServerDeploymentAvailable" ,
25- "APIServerDeploymentDegraded" ,
26- "APIServerDeploymentProgressing" ,
2771 "APIServerStaticResourcesDegraded" ,
2872 "APIServerWorkloadDegraded" ,
2973 "APIServicesAvailable" ,
3074 "APIServicesDegraded" ,
3175 "AuditPolicyDegraded" ,
32- "AuthConfigDegraded" ,
33- "AuthenticatorCertKeyProgressing" ,
3476 "CustomRouteControllerDegraded" ,
3577 "Encrypted" ,
3678 "EncryptionKeyControllerDegraded" ,
3779 "EncryptionMigrationControllerDegraded" ,
3880 "EncryptionMigrationControllerProgressing" ,
3981 "EncryptionPruneControllerDegraded" ,
4082 "EncryptionStateControllerDegraded" ,
41- "IngressConfigDegraded" ,
42- "IngressStateEndpointsDegraded" ,
43- "IngressStatePodsDegraded" ,
4483 "ManagementStateDegraded" ,
4584 "OAuthAPIServerConfigObservationDegraded" ,
4685 "OAuthClientsControllerDegraded" ,
47- "OAuthConfigDegraded" ,
48- "OAuthConfigIngressDegraded" ,
49- "OAuthConfigRouteDegraded" ,
50- "OAuthConfigServiceDegraded" ,
5186 "OAuthServerConfigObservationDegraded" ,
52- "OAuthServerDeploymentAvailable" ,
53- "OAuthServerDeploymentDegraded" ,
54- "OAuthServerDeploymentProgressing" ,
55- "OAuthServerRouteEndpointAccessibleControllerAvailable" ,
5687 "OAuthServerRouteEndpointAccessibleControllerDegraded" ,
57- "OAuthServerServiceEndpointAccessibleControllerAvailable" ,
5888 "OAuthServerServiceEndpointAccessibleControllerDegraded" ,
59- "OAuthServerServiceEndpointsEndpointAccessibleControllerAvailable" ,
6089 "OAuthServerServiceEndpointsEndpointAccessibleControllerDegraded" ,
6190 "OAuthServerWorkloadDegraded" ,
62- "OAuthServiceDegraded" ,
63- "OAuthSessionSecretDegraded" ,
64- "OAuthSystemMetadataDegraded" ,
6591 "OpenshiftAuthenticationStaticResourcesDegraded" ,
6692 "ProxyConfigControllerDegraded" ,
67- "ReadyIngressNodesAvailable" ,
6893 "ResourceSyncControllerDegraded" ,
6994 "RevisionControllerDegraded" ,
70- "RouterCertsDegraded" ,
7195 "RouterCertsDomainValidationControllerDegraded" ,
72- "SystemServiceCAConfigDegraded" ,
7396 "UnsupportedConfigOverridesUpgradeable" ,
7497 "WebhookAuthenticatorCertApprover_OpenShiftAuthenticatorDegraded" ,
7598 "WebhookAuthenticatorControllerDegraded" ,
76- "WellKnownAvailable" ,
7799 "WellKnownReadyControllerDegraded" ,
78- "WellKnownReadyControllerProgressing" ,
79100 },
80101 //{Group: "operator.openshift.io", Version: "v1", Resource: "clustercsidrivers"}: {}, // TODO special names
81102 {Group : "operator.openshift.io" , Version : "v1" , Resource : "configs" }: {
@@ -392,7 +413,15 @@ var _ = g.Describe("[sig-arch][Early] Operators", func() {
392413 operatorStatus , err := getOperatorStatusFromUnstructured (uncastOperatorResource .Object )
393414 o .Expect (err ).NotTo (o .HaveOccurred ())
394415
395- for _ , requiredCondition := range requiredConditions {
416+ var runtimeConditions []string
417+ if runtimeConditionsFunc := operatorResourceToConditionalConditions [gvr ]; runtimeConditionsFunc != nil {
418+ runtimeConditions , err = runtimeConditionsFunc (ctx , oc )
419+ if err != nil {
420+ failures = append (failures , fmt .Sprintf ("could not determine runtime conditions for resource=%v: %v" , gvr , err ))
421+ }
422+ }
423+
424+ for _ , requiredCondition := range append (requiredConditions , runtimeConditions ... ) {
396425 condition := v1helpers .FindOperatorCondition (operatorStatus .Conditions , requiredCondition )
397426 if condition == nil {
398427 failures = append (failures , fmt .Sprintf ("resource=%v is missing condition %q that was present in 4.17. If this is intentional, update the list in this test." , gvr , requiredCondition ))
0 commit comments