@@ -112,7 +112,7 @@ var _ = Describe("InstanceProfileProvider", func() {
112112 func (roleWithPath , role string ) {
113113 const profileName = "profile-A"
114114 nodeClass .Spec .Role = roleWithPath
115- Expect (awsEnv .InstanceProfileProvider .Create (ctx , profileName , role , nil , string (nodeClass .UID ))).To (Succeed ())
115+ Expect (awsEnv .InstanceProfileProvider .Create (ctx , profileName , role , nil , string (nodeClass .UID ), true )).To (Succeed ())
116116 Expect (profileName ).ToNot (BeNil ())
117117 Expect (awsEnv .IAMAPI .InstanceProfiles [profileName ].Roles ).To (HaveLen (1 ))
118118 Expect (aws .ToString (awsEnv .IAMAPI .InstanceProfiles [profileName ].Roles [0 ].RoleName )).To (Equal (role ))
@@ -269,7 +269,7 @@ var _ = Describe("InstanceProfileProvider", func() {
269269 nodeClassUID := "test-uid"
270270 expectedPath := fmt .Sprintf ("/karpenter/%s/%s/%s/" , fake .DefaultRegion , options .FromContext (ctx ).ClusterName , nodeClassUID )
271271
272- Expect (awsEnv .InstanceProfileProvider .Create (ctx , profileName , nodeRole , nil , nodeClassUID )).To (Succeed ())
272+ Expect (awsEnv .InstanceProfileProvider .Create (ctx , profileName , nodeRole , nil , nodeClassUID , true )).To (Succeed ())
273273
274274 // Get the created profile
275275 profile , err := awsEnv .InstanceProfileProvider .Get (ctx , profileName )
@@ -287,7 +287,7 @@ var _ = Describe("InstanceProfileProvider", func() {
287287 profileName := "profile-A"
288288 nodeClassUID := "test-uid"
289289
290- Expect (awsEnv .InstanceProfileProvider .Create (ctx , profileName , nodeRole , nil , nodeClassUID )).To (Succeed ())
290+ Expect (awsEnv .InstanceProfileProvider .Create (ctx , profileName , nodeRole , nil , nodeClassUID , true )).To (Succeed ())
291291
292292 // Verify profile exists
293293 Expect (awsEnv .IAMAPI .InstanceProfiles ).To (HaveKey (profileName ))
@@ -308,7 +308,7 @@ var _ = Describe("InstanceProfileProvider", func() {
308308 It ("should reflect IsProtected updates" , func () {
309309 // Create a profile
310310 profileName := "profile-A"
311- Expect (awsEnv .InstanceProfileProvider .Create (ctx , profileName , nodeRole , nil , "test-uid" )).To (Succeed ())
311+ Expect (awsEnv .InstanceProfileProvider .Create (ctx , profileName , nodeRole , nil , "test-uid" , true )).To (Succeed ())
312312
313313 // Initially should not be protected (protection is set in instance profile reconciler)
314314 Expect (awsEnv .InstanceProfileProvider .IsProtected (profileName )).To (BeFalse ())
@@ -331,14 +331,14 @@ var _ = Describe("InstanceProfileProvider", func() {
331331 }
332332 })
333333 It ("should not cache role not found errors when the role exists" , func () {
334- err := awsEnv .InstanceProfileProvider .Create (ctx , "test-profile" , roleName , nil , "test-uid" )
334+ err := awsEnv .InstanceProfileProvider .Create (ctx , "test-profile" , roleName , nil , "test-uid" , true )
335335 Expect (err ).ToNot (HaveOccurred ())
336336 _ , ok := awsEnv .RoleCache .Get (roleName )
337337 Expect (ok ).To (BeFalse ())
338338 })
339339 It ("should cache role not found errors when the role does not" , func () {
340340 missingRoleName := "non-existent-role"
341- err := awsEnv .InstanceProfileProvider .Create (ctx , "test-profile" , missingRoleName , nil , "test-uid" )
341+ err := awsEnv .InstanceProfileProvider .Create (ctx , "test-profile" , missingRoleName , nil , "test-uid" , true )
342342 Expect (err ).To (HaveOccurred ())
343343 _ , ok := awsEnv .RoleCache .Get (missingRoleName )
344344 Expect (ok ).To (BeTrue ())
@@ -347,7 +347,7 @@ var _ = Describe("InstanceProfileProvider", func() {
347347 missingRoleName := "non-existent-role"
348348 awsEnv .RoleCache .SetDefault (missingRoleName , errors .New ("role not found" ))
349349
350- err := awsEnv .InstanceProfileProvider .Create (ctx , "test-profile" , missingRoleName , nil , "test-uid" )
350+ err := awsEnv .InstanceProfileProvider .Create (ctx , "test-profile" , missingRoleName , nil , "test-uid" , true )
351351 Expect (err ).To (HaveOccurred ())
352352
353353 Expect (awsEnv .IAMAPI .InstanceProfiles ).To (HaveLen (0 ))
0 commit comments