Skip to content

Commit 80bdcec

Browse files
committed
tls: add cluster-authentication-operator and operands to tested components
Add the authentication operator (openshift-authentication-operator) and its OAuth server operand (openshift-authentication) to all target lists: observedConfigTargets, configMapTargets, serviceTargets, clusterOperatorTargets, and deploymentRolloutTargets. The authentication operator uses a non-standard ObservedConfig path (oauthServer.servingInfo instead of servingInfo). Add a servingInfoPath field to observedConfigTarget so testObservedConfig and verifyObservedConfigForTargets resolve the path dynamically, defaulting to ["servingInfo"] for all existing targets.
1 parent 50759b5 commit 80bdcec

1 file changed

Lines changed: 36 additions & 42 deletions

File tree

test/extended/tls/tls_observed_config.go

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type observedConfigTarget struct {
5353
namespace string
5454
operatorConfigGVR schema.GroupVersionResource
5555
operatorConfigName string
56+
servingInfoPath []string
5657
managementClusterComponent bool
5758
}
5859

@@ -103,13 +104,14 @@ type deploymentRolloutTarget struct {
103104
// samples.operator.openshift.io/v1 Config (no spec.observedConfig);
104105
// its TLS config is injected through the ConfigMap annotation instead.
105106
var observedConfigTargets = []observedConfigTarget{
106-
{namespace: "openshift-image-registry", operatorConfigGVR: schema.GroupVersionResource{Group: "imageregistry.operator.openshift.io", Version: "v1", Resource: "configs"}, operatorConfigName: "cluster"},
107-
{namespace: "openshift-controller-manager", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "openshiftcontrollermanagers"}, operatorConfigName: "cluster", managementClusterComponent: true},
108-
{namespace: "openshift-kube-apiserver", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "kubeapiservers"}, operatorConfigName: "cluster", managementClusterComponent: true},
109-
{namespace: "openshift-apiserver", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "openshiftapiservers"}, operatorConfigName: "cluster", managementClusterComponent: true},
110-
{namespace: "openshift-etcd", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "etcds"}, operatorConfigName: "cluster", managementClusterComponent: true},
111-
{namespace: "openshift-kube-controller-manager", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "kubecontrollermanagers"}, operatorConfigName: "cluster", managementClusterComponent: true},
112-
{namespace: "openshift-kube-scheduler", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "kubeschedulers"}, operatorConfigName: "cluster", managementClusterComponent: true},
107+
{namespace: "openshift-image-registry", operatorConfigGVR: schema.GroupVersionResource{Group: "imageregistry.operator.openshift.io", Version: "v1", Resource: "configs"}, operatorConfigName: "cluster", servingInfoPath: []string{"servingInfo"}},
108+
{namespace: "openshift-controller-manager", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "openshiftcontrollermanagers"}, operatorConfigName: "cluster", servingInfoPath: []string{"servingInfo"}, managementClusterComponent: true},
109+
{namespace: "openshift-kube-apiserver", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "kubeapiservers"}, operatorConfigName: "cluster", servingInfoPath: []string{"servingInfo"}, managementClusterComponent: true},
110+
{namespace: "openshift-apiserver", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "openshiftapiservers"}, operatorConfigName: "cluster", servingInfoPath: []string{"servingInfo"}, managementClusterComponent: true},
111+
{namespace: "openshift-etcd", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "etcds"}, operatorConfigName: "cluster", servingInfoPath: []string{"servingInfo"}, managementClusterComponent: true},
112+
{namespace: "openshift-kube-controller-manager", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "kubecontrollermanagers"}, operatorConfigName: "cluster", servingInfoPath: []string{"servingInfo"}, managementClusterComponent: true},
113+
{namespace: "openshift-kube-scheduler", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "kubeschedulers"}, operatorConfigName: "cluster", servingInfoPath: []string{"servingInfo"}, managementClusterComponent: true},
114+
{namespace: "openshift-authentication-operator", operatorConfigGVR: schema.GroupVersionResource{Group: "operator.openshift.io", Version: "v1", Resource: "authentications"}, operatorConfigName: "cluster", servingInfoPath: []string{"oauthServer", "servingInfo"}, managementClusterComponent: true},
113115
}
114116

115117
var configMapTargets = []configMapTarget{
@@ -121,6 +123,7 @@ var configMapTargets = []configMapTarget{
121123
{namespace: "openshift-kube-controller-manager", configMapName: "kube-controller-manager-operator-config", configMapNamespace: "openshift-kube-controller-manager-operator", configMapKey: "config.yaml", managementClusterComponent: true},
122124
{namespace: "openshift-kube-scheduler", configMapName: "openshift-kube-scheduler-operator-config", configMapNamespace: "openshift-kube-scheduler-operator", configMapKey: "config.yaml", managementClusterComponent: true},
123125
{namespace: "openshift-cluster-samples-operator", configMapName: "samples-operator-config", configMapNamespace: "openshift-cluster-samples-operator", configMapKey: "config.yaml"},
126+
{namespace: "openshift-authentication-operator", configMapName: "authentication-operator-config", configMapNamespace: "openshift-authentication-operator", configMapKey: "operator-config.yaml", managementClusterComponent: true},
124127
}
125128

126129
var deploymentEnvVarTargets = []deploymentEnvVarTarget{
@@ -139,6 +142,9 @@ var serviceTargets = []serviceTarget{
139142
{namespace: "openshift-kube-controller-manager", serviceName: "kube-controller-manager", servicePort: "443", managementClusterComponent: true},
140143
{namespace: "openshift-kube-scheduler", serviceName: "scheduler", servicePort: "443", managementClusterComponent: true},
141144
{namespace: "openshift-cluster-samples-operator", serviceName: "metrics", servicePort: "60000", deploymentName: "cluster-samples-operator"},
145+
{namespace: "openshift-authentication-operator", serviceName: "metrics", servicePort: "443", deploymentName: "authentication-operator", managementClusterComponent: true},
146+
{namespace: "openshift-authentication", serviceName: "oauth-openshift", servicePort: "443", deploymentName: "oauth-openshift", managementClusterComponent: true},
147+
{namespace: "openshift-oauth-apiserver", serviceName: "api", servicePort: "443", deploymentName: "apiserver", managementClusterComponent: true},
142148
}
143149

144150
// clusterOperatorTarget identifies a ClusterOperator whose stability is
@@ -157,6 +163,7 @@ var clusterOperatorTargets = []clusterOperatorTarget{
157163
{name: "kube-controller-manager", managementClusterComponent: true},
158164
{name: "kube-scheduler", managementClusterComponent: true},
159165
{name: "openshift-samples"},
166+
{name: "authentication", managementClusterComponent: true},
160167
}
161168

162169
var deploymentRolloutTargets = []deploymentRolloutTarget{
@@ -165,6 +172,9 @@ var deploymentRolloutTargets = []deploymentRolloutTarget{
165172
{namespace: "openshift-apiserver", deploymentName: "apiserver", managementClusterComponent: true},
166173
{namespace: "openshift-cluster-version", deploymentName: "cluster-version-operator", managementClusterComponent: true},
167174
{namespace: "openshift-cluster-samples-operator", deploymentName: "cluster-samples-operator"},
175+
{namespace: "openshift-authentication-operator", deploymentName: "authentication-operator", managementClusterComponent: true},
176+
{namespace: "openshift-authentication", deploymentName: "oauth-openshift", managementClusterComponent: true},
177+
{namespace: "openshift-oauth-apiserver", deploymentName: "apiserver", managementClusterComponent: true},
168178
}
169179

170180
// ─── Guest-side filters for HyperShift ─────────────────────────────────────
@@ -266,9 +276,6 @@ var _ = g.Describe("[sig-api-machinery][Feature:TLSObservedConfig][Serial][Suite
266276
for _, target := range configMapTargets {
267277
target := target
268278
g.It(fmt.Sprintf("should have TLS config injected into ConfigMap - %s", target.namespace), func() {
269-
if isHyperShiftCluster && target.managementClusterComponent {
270-
g.Skip(fmt.Sprintf("Skipping management-cluster component %s on HyperShift", target.namespace))
271-
}
272279
testConfigMapTLSInjection(oc, ctx, target)
273280
})
274281
}
@@ -352,30 +359,18 @@ var _ = g.Describe("[sig-api-machinery][Feature:TLSObservedConfig][Serial][Disru
352359
target := target
353360

354361
g.It(fmt.Sprintf("should restore inject-tls annotation after deletion - %s", target.namespace), func() {
355-
if isHyperShiftCluster && target.managementClusterComponent {
356-
g.Skip(fmt.Sprintf("Skipping management-cluster component %s on HyperShift", target.namespace))
357-
}
358362
testAnnotationRestorationAfterDeletion(oc, ctx, target)
359363
})
360364

361365
g.It(fmt.Sprintf("should restore inject-tls annotation when set to false - %s", target.namespace), func() {
362-
if isHyperShiftCluster && target.managementClusterComponent {
363-
g.Skip(fmt.Sprintf("Skipping management-cluster component %s on HyperShift", target.namespace))
364-
}
365366
testAnnotationRestorationWhenFalse(oc, ctx, target)
366367
})
367368

368369
g.It(fmt.Sprintf("should restore servingInfo after removal - %s", target.namespace), func() {
369-
if isHyperShiftCluster && target.managementClusterComponent {
370-
g.Skip(fmt.Sprintf("Skipping management-cluster component %s on HyperShift", target.namespace))
371-
}
372370
testServingInfoRestorationAfterRemoval(oc, ctx, target)
373371
})
374372

375373
g.It(fmt.Sprintf("should restore servingInfo after modification - %s", target.namespace), func() {
376-
if isHyperShiftCluster && target.managementClusterComponent {
377-
g.Skip(fmt.Sprintf("Skipping management-cluster component %s on HyperShift", target.namespace))
378-
}
379374
testServingInfoRestorationAfterModification(oc, ctx, target)
380375
})
381376
}
@@ -800,25 +795,24 @@ func testObservedConfig(oc *exutil.CLI, ctx context.Context, t observedConfigTar
800795
observedJSON, _ := json.MarshalIndent(observedConfigRaw, "", " ")
801796
e2e.Logf("ObservedConfig:\n%s", string(observedJSON))
802797

803-
// Verify servingInfo exists.
804-
g.By("verifying servingInfo in ObservedConfig")
805-
_, found, err = unstructured.NestedMap(observedConfigRaw, "servingInfo")
806-
o.Expect(err).NotTo(o.HaveOccurred(), "failed to get servingInfo from observedConfig")
807-
o.Expect(found).To(o.BeTrue(), "expected servingInfo in ObservedConfig")
808-
809-
// Verify minTLSVersion is populated.
810-
g.By("verifying servingInfo.minTLSVersion in ObservedConfig")
811-
minTLSVersion, found, err := unstructured.NestedString(observedConfigRaw, "servingInfo", "minTLSVersion")
812-
o.Expect(err).NotTo(o.HaveOccurred(), "failed to get servingInfo.minTLSVersion")
813-
o.Expect(found).To(o.BeTrue(), "expected minTLSVersion in servingInfo")
798+
siLabel := strings.Join(t.servingInfoPath, ".")
799+
800+
g.By(fmt.Sprintf("verifying %s in ObservedConfig", siLabel))
801+
_, found, err = unstructured.NestedMap(observedConfigRaw, t.servingInfoPath...)
802+
o.Expect(err).NotTo(o.HaveOccurred(), fmt.Sprintf("failed to get %s from observedConfig", siLabel))
803+
o.Expect(found).To(o.BeTrue(), fmt.Sprintf("expected %s in ObservedConfig", siLabel))
804+
805+
g.By(fmt.Sprintf("verifying %s.minTLSVersion in ObservedConfig", siLabel))
806+
minTLSVersion, found, err := unstructured.NestedString(observedConfigRaw, append(t.servingInfoPath, "minTLSVersion")...)
807+
o.Expect(err).NotTo(o.HaveOccurred(), fmt.Sprintf("failed to get %s.minTLSVersion", siLabel))
808+
o.Expect(found).To(o.BeTrue(), fmt.Sprintf("expected minTLSVersion in %s", siLabel))
814809
o.Expect(minTLSVersion).NotTo(o.BeEmpty(), "expected minTLSVersion to be non-empty")
815-
e2e.Logf("ObservedConfig servingInfo.minTLSVersion: %s", minTLSVersion)
810+
e2e.Logf("ObservedConfig %s.minTLSVersion: %s", siLabel, minTLSVersion)
816811

817-
// Verify cipherSuites is populated.
818-
g.By("verifying servingInfo.cipherSuites in ObservedConfig")
819-
cipherSuites, found, err := unstructured.NestedStringSlice(observedConfigRaw, "servingInfo", "cipherSuites")
820-
o.Expect(err).NotTo(o.HaveOccurred(), "failed to get servingInfo.cipherSuites")
821-
o.Expect(found).To(o.BeTrue(), "expected cipherSuites in servingInfo")
812+
g.By(fmt.Sprintf("verifying %s.cipherSuites in ObservedConfig", siLabel))
813+
cipherSuites, found, err := unstructured.NestedStringSlice(observedConfigRaw, append(t.servingInfoPath, "cipherSuites")...)
814+
o.Expect(err).NotTo(o.HaveOccurred(), fmt.Sprintf("failed to get %s.cipherSuites", siLabel))
815+
o.Expect(found).To(o.BeTrue(), fmt.Sprintf("expected cipherSuites in %s", siLabel))
822816
o.Expect(cipherSuites).NotTo(o.BeEmpty(), "expected cipherSuites to be non-empty")
823817
e2e.Logf("ObservedConfig servingInfo.cipherSuites: %d suites", len(cipherSuites))
824818

@@ -1308,11 +1302,11 @@ func verifyObservedConfigForTargets(oc *exutil.CLI, ctx context.Context, expecte
13081302
fmt.Sprintf("expected spec.observedConfig in %s/%s after %s switch",
13091303
t.operatorConfigGVR.Resource, t.operatorConfigName, profileLabel))
13101304

1311-
minTLSVersion, found, err := unstructured.NestedString(observedConfigRaw, "servingInfo", "minTLSVersion")
1305+
minTLSVersion, found, err := unstructured.NestedString(observedConfigRaw, append(t.servingInfoPath, "minTLSVersion")...)
13121306
o.Expect(err).NotTo(o.HaveOccurred())
13131307
o.Expect(found).To(o.BeTrue(),
1314-
fmt.Sprintf("expected servingInfo.minTLSVersion in ObservedConfig of %s/%s after %s switch",
1315-
t.operatorConfigGVR.Resource, t.operatorConfigName, profileLabel))
1308+
fmt.Sprintf("expected %s.minTLSVersion in ObservedConfig of %s/%s after %s switch",
1309+
strings.Join(t.servingInfoPath, "."), t.operatorConfigGVR.Resource, t.operatorConfigName, profileLabel))
13161310
o.Expect(minTLSVersion).To(o.Equal(expectedVersion),
13171311
fmt.Sprintf("ObservedConfig %s/%s: expected minTLSVersion=%s after %s switch, got %s",
13181312
t.operatorConfigGVR.Resource, t.operatorConfigName, expectedVersion, profileLabel, minTLSVersion))

0 commit comments

Comments
 (0)