@@ -118,9 +118,9 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
118
118
// gather vars for resolution
119
119
vars , err := r .variables (ctx )
120
120
if err != nil {
121
- ext .Status .InstalledBundleResource = ""
121
+ ext .Status .InstalledBundle = nil
122
122
setInstalledStatusConditionUnknown (& ext .Status .Conditions , "installation has not been attempted due to failure to gather data for resolution" , ext .GetGeneration ())
123
- ext .Status .ResolvedBundleResource = ""
123
+ ext .Status .ResolvedBundle = nil
124
124
setResolvedStatusConditionFailed (& ext .Status .Conditions , err .Error (), ext .GetGeneration ())
125
125
126
126
setDeprecationStatusesUnknown (& ext .Status .Conditions , "deprecation checks have not been attempted due to failure to gather data for resolution" , ext .GetGeneration ())
@@ -130,9 +130,9 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
130
130
// run resolution
131
131
selection , err := r .Resolver .Solve (vars )
132
132
if err != nil {
133
- ext .Status .InstalledBundleResource = ""
133
+ ext .Status .InstalledBundle = nil
134
134
setInstalledStatusConditionUnknown (& ext .Status .Conditions , "installation has not been attempted as resolution failed" , ext .GetGeneration ())
135
- ext .Status .ResolvedBundleResource = ""
135
+ ext .Status .ResolvedBundle = nil
136
136
setResolvedStatusConditionFailed (& ext .Status .Conditions , err .Error (), ext .GetGeneration ())
137
137
138
138
setDeprecationStatusesUnknown (& ext .Status .Conditions , "deprecation checks have not been attempted as resolution failed" , ext .GetGeneration ())
@@ -143,17 +143,17 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
143
143
// ClusterExtension's desired package name.
144
144
bundle , err := r .bundleFromSolution (selection , ext .Spec .PackageName )
145
145
if err != nil {
146
- ext .Status .InstalledBundleResource = ""
146
+ ext .Status .InstalledBundle = nil
147
147
setInstalledStatusConditionUnknown (& ext .Status .Conditions , "installation has not been attempted as resolution failed" , ext .GetGeneration ())
148
- ext .Status .ResolvedBundleResource = ""
148
+ ext .Status .ResolvedBundle = nil
149
149
setResolvedStatusConditionFailed (& ext .Status .Conditions , err .Error (), ext .GetGeneration ())
150
150
151
151
setDeprecationStatusesUnknown (& ext .Status .Conditions , "deprecation checks have not been attempted as resolution failed" , ext .GetGeneration ())
152
152
return ctrl.Result {}, err
153
153
}
154
154
155
155
// Now we can set the Resolved Condition, and the resolvedBundleSource field to the bundle.Image value.
156
- ext .Status .ResolvedBundleResource = bundle . Image
156
+ ext .Status .ResolvedBundle = bundleMetadataFor ( bundle )
157
157
setResolvedStatusConditionSuccess (& ext .Status .Conditions , fmt .Sprintf ("resolved to %q" , bundle .Image ), ext .GetGeneration ())
158
158
159
159
// TODO: Question - Should we set the deprecation statuses after we have successfully resolved instead of after a successful installation?
@@ -175,7 +175,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
175
175
dep := r .GenerateExpectedBundleDeployment (* ext , bundle .Image , bundleProvisioner )
176
176
if err := r .ensureBundleDeployment (ctx , dep ); err != nil {
177
177
// originally Reason: ocv1alpha1.ReasonInstallationFailed
178
- ext .Status .InstalledBundleResource = ""
178
+ ext .Status .InstalledBundle = nil
179
179
setInstalledStatusConditionFailed (& ext .Status .Conditions , err .Error (), ext .GetGeneration ())
180
180
setDeprecationStatusesUnknown (& ext .Status .Conditions , "deprecation checks have not been attempted as installation has failed" , ext .GetGeneration ())
181
181
return ctrl.Result {}, err
@@ -185,15 +185,15 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
185
185
existingTypedBundleDeployment := & rukpakv1alpha2.BundleDeployment {}
186
186
if err := runtime .DefaultUnstructuredConverter .FromUnstructured (dep .UnstructuredContent (), existingTypedBundleDeployment ); err != nil {
187
187
// originally Reason: ocv1alpha1.ReasonInstallationStatusUnknown
188
- ext .Status .InstalledBundleResource = ""
188
+ ext .Status .InstalledBundle = nil
189
189
setInstalledStatusConditionUnknown (& ext .Status .Conditions , err .Error (), ext .GetGeneration ())
190
190
setDeprecationStatusesUnknown (& ext .Status .Conditions , "deprecation checks have not been attempted as installation has failed" , ext .GetGeneration ())
191
191
return ctrl.Result {}, err
192
192
}
193
193
194
- // Let's set the proper Installed condition and InstalledBundleResource field based on the
194
+ // Let's set the proper Installed condition and InstalledBundle field based on the
195
195
// existing BundleDeployment object status.
196
- mapBDStatusToInstalledCondition (existingTypedBundleDeployment , ext )
196
+ mapBDStatusToInstalledCondition (existingTypedBundleDeployment , ext , bundle )
197
197
198
198
SetDeprecationStatus (ext , bundle )
199
199
@@ -218,16 +218,16 @@ func (r *ClusterExtensionReconciler) variables(ctx context.Context) ([]deppy.Var
218
218
return GenerateVariables (allBundles , clusterExtensionList .Items , bundleDeploymentList .Items )
219
219
}
220
220
221
- func mapBDStatusToInstalledCondition (existingTypedBundleDeployment * rukpakv1alpha2.BundleDeployment , ext * ocv1alpha1.ClusterExtension ) {
221
+ func mapBDStatusToInstalledCondition (existingTypedBundleDeployment * rukpakv1alpha2.BundleDeployment , ext * ocv1alpha1.ClusterExtension , bundle * catalogmetadata. Bundle ) {
222
222
bundleDeploymentReady := apimeta .FindStatusCondition (existingTypedBundleDeployment .Status .Conditions , rukpakv1alpha2 .TypeInstalled )
223
223
if bundleDeploymentReady == nil {
224
- ext .Status .InstalledBundleResource = ""
224
+ ext .Status .InstalledBundle = nil
225
225
setInstalledStatusConditionUnknown (& ext .Status .Conditions , "bundledeployment status is unknown" , ext .GetGeneration ())
226
226
return
227
227
}
228
228
229
229
if bundleDeploymentReady .Status != metav1 .ConditionTrue {
230
- ext .Status .InstalledBundleResource = ""
230
+ ext .Status .InstalledBundle = nil
231
231
setInstalledStatusConditionFailed (
232
232
& ext .Status .Conditions ,
233
233
fmt .Sprintf ("bundledeployment not ready: %s" , bundleDeploymentReady .Message ),
@@ -236,25 +236,25 @@ func mapBDStatusToInstalledCondition(existingTypedBundleDeployment *rukpakv1alph
236
236
return
237
237
}
238
238
239
+ installedBundle := bundleMetadataFor (bundle )
239
240
bundleDeploymentSource := existingTypedBundleDeployment .Spec .Source
240
241
switch bundleDeploymentSource .Type {
241
242
case rukpakv1alpha2 .SourceTypeImage :
242
- ext .Status .InstalledBundleResource = bundleDeploymentSource . Image . Ref
243
+ ext .Status .InstalledBundle = installedBundle
243
244
setInstalledStatusConditionSuccess (
244
245
& ext .Status .Conditions ,
245
246
fmt .Sprintf ("installed from %q" , bundleDeploymentSource .Image .Ref ),
246
247
ext .GetGeneration (),
247
248
)
248
249
case rukpakv1alpha2 .SourceTypeGit :
250
+ ext .Status .InstalledBundle = installedBundle
249
251
resource := bundleDeploymentSource .Git .Repository + "@" + bundleDeploymentSource .Git .Ref .Commit
250
- ext .Status .InstalledBundleResource = resource
251
252
setInstalledStatusConditionSuccess (
252
253
& ext .Status .Conditions ,
253
254
fmt .Sprintf ("installed from %q" , resource ),
254
255
ext .GetGeneration (),
255
256
)
256
257
default :
257
- ext .Status .InstalledBundleResource = ""
258
258
setInstalledStatusConditionUnknown (
259
259
& ext .Status .Conditions ,
260
260
fmt .Sprintf ("unknown bundledeployment source type %q" , bundleDeploymentSource .Type ),
0 commit comments