@@ -49,14 +49,20 @@ func (s *Service) reconcileIdentityProvider(ctx context.Context) error {
49
49
}
50
50
51
51
s .scope .V (2 ).Info ("creating oidc provider plan" , "desired" , desired , "current" , current )
52
+ procedures , err := identityprovider .
53
+ NewPlan (clusterName , current , desired , s .EKSClient , s .scope .Logger ).
54
+ Create (ctx )
52
55
53
- identityProviderPlan := identityprovider .NewPlan (clusterName , current , desired , s .EKSClient , s .scope .Logger )
54
-
55
- procedures , err := identityProviderPlan .Create (ctx )
56
56
if err != nil {
57
57
s .scope .Error (err , "failed creating eks identity provider plan" )
58
58
return fmt .Errorf ("creating eks identity provider plan: %w" , err )
59
59
}
60
+
61
+ // nothing will be done, we can leave
62
+ if len (procedures ) == 0 {
63
+ return nil
64
+ }
65
+
60
66
s .scope .V (2 ).Info ("computed EKS identity provider plan" , "numprocs" , len (procedures ))
61
67
62
68
// Perform required operations
@@ -73,16 +79,24 @@ func (s *Service) reconcileIdentityProvider(ctx context.Context) error {
73
79
return errors .Wrap (err , "getting associated identity provider" )
74
80
}
75
81
76
- if latest != nil {
77
- s .scope .ControlPlane .Status .IdentityProviderStatus = ekscontrolplanev1.IdentityProviderStatus {
78
- ARN : latest .IdentityProviderConfigArn ,
79
- Status : latest .Status ,
80
- }
82
+ if latest == nil {
83
+ return nil
84
+ }
81
85
82
- err := s .scope .PatchObject ()
83
- if err != nil {
84
- return errors .Wrap (err , "updating identity provider status" )
85
- }
86
+ // don't patch if arn/status is the same
87
+ if latest .IdentityProviderConfigArn == s .scope .ControlPlane .Status .IdentityProviderStatus .ARN &&
88
+ latest .Status == s .scope .ControlPlane .Status .IdentityProviderStatus .Status {
89
+ return nil
90
+ }
91
+
92
+ // idp status has changed, patch the control plane
93
+ s .scope .ControlPlane .Status .IdentityProviderStatus = ekscontrolplanev1.IdentityProviderStatus {
94
+ ARN : latest .IdentityProviderConfigArn ,
95
+ Status : latest .Status ,
96
+ }
97
+
98
+ if err := s .scope .PatchObject (); err != nil {
99
+ return errors .Wrap (err , "updating identity provider status" )
86
100
}
87
101
88
102
return nil
0 commit comments