Skip to content

ClusterGenerator - return labels as generic maps.#110

Merged
bigkevmcd merged 2 commits intomainfrom
labels-as-generic
Aug 10, 2023
Merged

ClusterGenerator - return labels as generic maps.#110
bigkevmcd merged 2 commits intomainfrom
labels-as-generic

Conversation

@bigkevmcd
Copy link
Copy Markdown
Collaborator

The Sprig get function requires a map[string]interface{} https://github.com/Masterminds/sprig/blob/581758eb7d96ae4d113649668fa96acc74d46e7f/dict.go#L8

We return a map[string]string of labels and annotations, because that's how they come from the GitopsCluster as a Kubernetes resource.

This does a simple conversion to map[string]any which should be able to be used by the get function.

The Sprig get function requires a map[string]interface{} https://github.com/Masterminds/sprig/blob/581758eb7d96ae4d113649668fa96acc74d46e7f/dict.go#L8

We return a map[string]string of labels and annotations, because that's
how they come from the GitopsCluster as a Kubernetes resource.

This does a simple conversion to map[string]any which should be able to
be used by the get function.
@bigkevmcd bigkevmcd requested a review from foot August 10, 2023 10:12
@bigkevmcd
Copy link
Copy Markdown
Collaborator Author

@darrylweaver this should solve your get function issue.

Copy link
Copy Markdown
Collaborator

@foot foot left a comment

Choose a reason for hiding this comment

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

Make sense! Worth adding a {{ get ... }} test too, or a bit specific ?

@bigkevmcd
Copy link
Copy Markdown
Collaborator Author

Make sense! Worth adding a {{ get ... }} test too, or a bit specific ?
Good idea, I added one!

@bigkevmcd bigkevmcd merged commit 2dfb9be into main Aug 10, 2023
@bigkevmcd bigkevmcd deleted the labels-as-generic branch August 10, 2023 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants