operator-sdk icon indicating copy to clipboard operation
operator-sdk copied to clipboard

Need an example of spec.icon usage in a CSV file

Open dubauski opened this issue 7 years ago • 3 comments

Type of question

Help around operator-sdk and best practices

Question

How do I provide correct value for spec.icon in a CSV file? Are there additional fields that need to be set for it to work? Please provide a working example to follow.

What did you do? I've searched for hours for any sample on how spec.icon field is used and found none. The only piece of documentation found is on https://docs.openshift.com/container-platform/4.2/operators/operator_sdk/osdk-generating-csvs.html#osdk-manually-defined-csv-fields_osdk-generating-csvs which states:

"spec.icon --- A base64-encoded icon unique to the Operator, set in a base64data field with a mediatype." What does it mean? does actual encoded data need to be provided in a spec.base64data field and spec.icon somehow references it?

I tried to guess what correct value should be given and tried this:

spec: ... icon: image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSk...

but this caused my operator not show up in the OperatorHub. I tried to bring my operator back up in OperatorHub by undoing this change but nothing helped. I ended up creating a brand new image with my operator (new tag) just to restore my original state. This discouraged me from further guessing game and hence this issue.

Thank you for any clarification on this.

What did you expect to see? Provide a clear explanation with example on how to provide the correct value for spec.icon.

dubauski avatar Nov 15 '19 06:11 dubauski

I was digging around for any clue about proper usage and found reference to

spec.icon: Base64 encoded image. E.g. cat icon.png | Base64 or base64 -w 0 icon.png

I've tried setting spec.icon value to output of the above cat command but it didn't work.

dubauski avatar Nov 15 '19 06:11 dubauski

Never mind found it: https://github.com/operator-framework/operator-lifecycle-manager/blob/4197455/Documentation/design/building-your-csv.md

Icon: a base64 encoded image of the Operator logo or the logo of the publisher. The base64data parameter contains the data and the mediatype specifies the type of image, eg. image/png or image/svg.

Example:

icon:

  • base64data: mediatype: image/png

dubauski avatar Nov 15 '19 17:11 dubauski

for those that will try to use svg, image/svg didnt worked for me, but image/svg+xml did worked

zfrhv avatar Dec 22 '21 07:12 zfrhv