Skip to content

Commit 1cae687

Browse files
authored
fix: default the resource version to component version (#679)
<!-- markdownlint-disable MD041 --> #### What this PR does / why we need it Fixes #629 #### Which issue(s) this PR fixes <!-- Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Signed-off-by: Gergely Brautigam <[email protected]>
1 parent 57f7cb4 commit 1cae687

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

controllers/resource_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func (r *ResourceReconciler) reconcile(
205205
// The reader is unused here, but we should still close it, so it's not left over.
206206
defer reader.Close()
207207

208-
version := "latest"
208+
version := componentVersion.Status.ReconciledVersion
209209
// GetVersion returns resourceRef.Version
210210
if obj.Spec.SourceRef.GetVersion() != "" {
211211
version = obj.Spec.SourceRef.GetVersion()

pkg/ocm/ocm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ func (c *Client) GetResource(
172172
cv *v1alpha1.ComponentVersion,
173173
resource *v1alpha1.ResourceReference,
174174
) (io.ReadCloser, string, int64, error) {
175-
version := "latest"
175+
// we default to the latest component version if we don't have any versions for the resource.
176+
version := cv.Status.ReconciledVersion
176177
if resource.ElementMeta.Version != "" {
177178
version = resource.ElementMeta.Version
178179
}

0 commit comments

Comments
 (0)