@@ -81,14 +81,14 @@ func (p *PhaseError) Error() string {
81
81
return p .Err .Error ()
82
82
}
83
83
84
- func wrapPhaseError (err error , reason string , ctype clusterv1. ConditionType ) error {
84
+ func wrapPhaseError (err error , reason string ) error {
85
85
if err == nil {
86
86
return nil
87
87
}
88
88
89
89
return & PhaseError {
90
90
Err : err ,
91
- Type : ctype ,
91
+ Type : operatorv1 . ProviderInstalledCondition ,
92
92
Reason : reason ,
93
93
Severity : clusterv1 .ConditionSeverityWarning ,
94
94
}
@@ -115,7 +115,7 @@ func (p *phaseReconciler) initializePhaseReconciler(ctx context.Context) (reconc
115
115
// Load provider's secret and config url.
116
116
reader , err := p .secretReader (ctx )
117
117
if err != nil {
118
- return reconcile.Result {}, wrapPhaseError (err , "failed to load the secret reader" , operatorv1 . PreflightCheckCondition )
118
+ return reconcile.Result {}, wrapPhaseError (err , "failed to load the secret reader" )
119
119
}
120
120
121
121
// Initialize a client for interacting with the clusterctl configuration.
@@ -128,7 +128,7 @@ func (p *phaseReconciler) initializePhaseReconciler(ctx context.Context) (reconc
128
128
// This is done using clusterctl internal API types.
129
129
p .providerConfig , err = p .configClient .Providers ().Get (p .provider .GetName (), util .ClusterctlProviderType (p .provider ))
130
130
if err != nil {
131
- return reconcile.Result {}, wrapPhaseError (err , operatorv1 .UnknownProviderReason , operatorv1 . PreflightCheckCondition )
131
+ return reconcile.Result {}, wrapPhaseError (err , operatorv1 .UnknownProviderReason )
132
132
}
133
133
134
134
spec := p .provider .GetSpec ()
@@ -164,7 +164,7 @@ func (p *phaseReconciler) load(ctx context.Context) (reconcile.Result, error) {
164
164
165
165
p .repo , err = p .configmapRepository (ctx , labelSelector )
166
166
if err != nil {
167
- return reconcile.Result {}, wrapPhaseError (err , "failed to load the repository" , operatorv1 . PreflightCheckCondition )
167
+ return reconcile.Result {}, wrapPhaseError (err , "failed to load the repository" )
168
168
}
169
169
170
170
// Store some provider specific inputs for passing it to clusterctl library
@@ -175,7 +175,7 @@ func (p *phaseReconciler) load(ctx context.Context) (reconcile.Result, error) {
175
175
}
176
176
177
177
if err := p .validateRepoCAPIVersion (); err != nil {
178
- return reconcile.Result {}, wrapPhaseError (err , operatorv1 .CAPIVersionIncompatibilityReason , operatorv1 . PreflightCheckCondition )
178
+ return reconcile.Result {}, wrapPhaseError (err , operatorv1 .CAPIVersionIncompatibilityReason )
179
179
}
180
180
181
181
return reconcile.Result {}, nil
@@ -319,7 +319,7 @@ func (p *phaseReconciler) fetch(ctx context.Context) (reconcile.Result, error) {
319
319
if err != nil {
320
320
err = fmt .Errorf ("failed to read %q from provider's repository %q: %w" , p .repo .ComponentsPath (), p .providerConfig .ManifestLabel (), err )
321
321
322
- return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason , operatorv1 . PreflightCheckCondition )
322
+ return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason )
323
323
}
324
324
325
325
// Generate a set of new objects using the clusterctl library. NewComponents() will do the yaml processing,
@@ -333,17 +333,17 @@ func (p *phaseReconciler) fetch(ctx context.Context) (reconcile.Result, error) {
333
333
Options : p .options ,
334
334
})
335
335
if err != nil {
336
- return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason , operatorv1 . PreflightCheckCondition )
336
+ return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason )
337
337
}
338
338
339
339
// ProviderSpec provides fields for customizing the provider deployment options.
340
340
// We can use clusterctl library to apply this customizations.
341
341
err = repository .AlterComponents (p .components , customizeObjectsFn (p .provider ))
342
342
if err != nil {
343
- return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason , operatorv1 . PreflightCheckCondition )
343
+ return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason )
344
344
}
345
345
346
- conditions .Set (p .provider , conditions .TrueCondition (operatorv1 .PreflightCheckCondition ))
346
+ conditions .Set (p .provider , conditions .TrueCondition (operatorv1 .ProviderInstalledCondition ))
347
347
348
348
return reconcile.Result {}, nil
349
349
}
@@ -355,7 +355,7 @@ func (p *phaseReconciler) preInstall(ctx context.Context) (reconcile.Result, err
355
355
356
356
needPreDelete , err := p .versionChanged ()
357
357
if err != nil {
358
- return reconcile.Result {}, wrapPhaseError (err , "failed getting clusterctl Provider version" , operatorv1 . ProviderInstalledCondition )
358
+ return reconcile.Result {}, wrapPhaseError (err , "failed getting clusterctl Provider version" )
359
359
}
360
360
361
361
// we need to delete existing components only if their version changes and something has already been installed.
@@ -397,7 +397,7 @@ func (p *phaseReconciler) install(ctx context.Context) (reconcile.Result, error)
397
397
398
398
versionChanged , err := p .versionChanged ()
399
399
if err != nil {
400
- return reconcile.Result {}, wrapPhaseError (err , "failed getting clusterctl Provider version" , operatorv1 . ProviderInstalledCondition )
400
+ return reconcile.Result {}, wrapPhaseError (err , "failed getting clusterctl Provider version" )
401
401
}
402
402
403
403
// skip installation if the version hasn't changed.
@@ -416,7 +416,7 @@ func (p *phaseReconciler) install(ctx context.Context) (reconcile.Result, error)
416
416
reason = "Timed out waiting for deployment to become ready"
417
417
}
418
418
419
- return reconcile.Result {}, wrapPhaseError (err , reason , operatorv1 . ProviderInstalledCondition )
419
+ return reconcile.Result {}, wrapPhaseError (err , reason )
420
420
}
421
421
422
422
status := p .provider .GetStatus ()
@@ -455,7 +455,7 @@ func (p *phaseReconciler) delete(ctx context.Context) (reconcile.Result, error)
455
455
IncludeCRDs : false ,
456
456
})
457
457
458
- return reconcile.Result {}, wrapPhaseError (err , operatorv1 .OldComponentsDeletionErrorReason , operatorv1 . ProviderInstalledCondition )
458
+ return reconcile.Result {}, wrapPhaseError (err , operatorv1 .OldComponentsDeletionErrorReason )
459
459
}
460
460
461
461
func clusterctlProviderName (provider genericprovider.GenericProvider ) client.ObjectKey {
0 commit comments