Skip to content

Fix: Invalid app version label when using hash in custom image #1076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

maltesander
Copy link
Member

Description

When using custom images like:

---
apiVersion: spark.stackable.tech/v1alpha1
kind: SparkApplication
metadata:
  name: spark-ny-cm
spec:
  sparkImage:
    productVersion: 3.5.6
    custom: oci.stackable.tech/sdp/spark-k8s:3.5.6-stackable25.7.0@sha256:c8b77ba72de6f8ddb99cb484b5ee79c43623cc2514d1448243f7d65d0ef66212
    #custom: oci.stackable.tech/sdp/spark-k8s@sha256:c8b77ba72de6f8ddb99cb484b5ee79c43623cc2514d1448243f7d65d0ef66212

the operator errors out due to creating invalid labels:

2025-08-07T10:52:54.347504Z ERROR app_controller: stackable_operator::logging::controller: Failed to reconcile object controller.name="sparkapplication.spark.stackable.tech" error=reconciler for object SparkApplication.v1alpha1.spark.stackable.tech/spark-ny-cm.default failed error.sources=[failed to build Metadata, failed to set recommended labels, failed to parse value "3.5.2-sha256:15725cf7ee1d648dd81e3bcbf8bcfff8e34d922182d5101abc" of key "app.kubernetes.io/version", value violates kubernetes format]

This is a quick and dirty fix replacing all ":" in the hash_or_tag_image used for creating the label with "-" and parsing it as LabelValue.

This is breaking as the "resolve" method now returns an error.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added

@maltesander maltesander moved this to Development: Waiting for Review in Stackable Engineering Aug 11, 2025
sbernauer
sbernauer previously approved these changes Aug 12, 2025
Copy link
Member

@sbernauer sbernauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like us now using a typed value :)
Only some nits

@sbernauer sbernauer moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Aug 12, 2025
Co-authored-by: Sebastian Bernauer <[email protected]>
Copy link
Member

@Techassi Techassi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking for now, I will come back to this later today.

sbernauer
sbernauer previously approved these changes Aug 12, 2025
Copy link
Member

@sbernauer sbernauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the bug!

@maltesander maltesander requested a review from Techassi August 12, 2025 11:57
Copy link
Member

@Techassi Techassi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last nit-pick, then ready to go.


- BREAKING: Fix bug where `ResolvedProductImage::app_version_label` could not be used as a label value because it can contain invalid characters.
This is the case when referencing custom images via a `@sha256:...` hash. As such, the `product_image_selection::resolve` function is now fallible.
The `ResolvedProductImage` field `app_version_label` was renamed to `app_version_label_value` to match its type ([#1076]).
Copy link
Member

@Techassi Techassi Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Please move this (line 11) into the "changed" section instead. Make sure to also prefix it with BREAKING.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done e4f1f88

@maltesander maltesander requested a review from Techassi August 12, 2025 13:44
@maltesander maltesander enabled auto-merge August 12, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Development: In Review
Development

Successfully merging this pull request may close these issues.

3 participants