@@ -26,6 +26,7 @@ import (
26
26
kbtutil "sigs.k8s.io/kubebuilder/v3/pkg/plugin/util"
27
27
28
28
"github.com/operator-framework/operator-sdk/internal/testutils"
29
+ "github.com/operator-framework/operator-sdk/test/common"
29
30
)
30
31
31
32
var _ = Describe ("Running ansible projects" , func () {
@@ -244,6 +245,15 @@ var _ = Describe("Running ansible projects", func() {
244
245
}
245
246
Eventually (verifyMemcachedPatch , time .Minute , time .Second ).Should (Succeed ())
246
247
248
+ // As of Kubernetes 1.24 a ServiceAccount no longer has a ServiceAccount token secret autogenerated. We have to create it manually here
249
+ By ("Creating the ServiceAccount token" )
250
+ secretFile , err := common .GetSASecret (tc .Kubectl .ServiceAccount , tc .Dir )
251
+ Expect (err ).NotTo (HaveOccurred ())
252
+ Eventually (func () error {
253
+ _ , err = tc .Kubectl .Apply (true , "-f" , secretFile )
254
+ return err
255
+ }, time .Minute , time .Second ).Should (Succeed ())
256
+
247
257
By ("granting permissions to access the metrics and read the token" )
248
258
_ , err = tc .Kubectl .Command ("create" , "clusterrolebinding" , metricsClusterRoleBindingName ,
249
259
fmt .Sprintf ("--clusterrole=%s-metrics-reader" , tc .ProjectName ),
@@ -263,8 +273,7 @@ var _ = Describe("Running ansible projects", func() {
263
273
264
274
By ("creating a curl pod" )
265
275
cmdOpts := []string {
266
- "run" , "curl" , "--image=curlimages/curl:7.68.0" , "--restart=OnFailure" ,
267
- "--serviceaccount" , tc .Kubectl .ServiceAccount , "--" ,
276
+ "run" , "curl" , "--image=curlimages/curl:7.68.0" , "--restart=OnFailure" , "--" ,
268
277
"curl" , "-v" , "-k" , "-H" , fmt .Sprintf (`Authorization: Bearer %s` , token ),
269
278
fmt .Sprintf ("https://%s-controller-manager-metrics-service.%s.svc:8443/metrics" , tc .ProjectName , tc .Kubectl .Namespace ),
270
279
}
0 commit comments