Skip to content

Conversation

@Diaphteiros
Copy link
Contributor

What this PR does / why we need it:

Which issue(s) this PR fixes:
None

Special notes for your reviewer:

Release note:

Added a first version of the ClusterProvider documentation.

reshnm
reshnm previously approved these changes Sep 2, 2025
ValentinGerlach
ValentinGerlach previously approved these changes Sep 2, 2025
Copy link
Member

@ValentinGerlach ValentinGerlach left a comment

Choose a reason for hiding this comment

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

Thank you for taking the time to write this down! I left some comments for things that we can improve in the future.

Comment on lines +227 to +229
ctrlutils.HasLabelPredicate(clustersv1alpha1.ProviderLabel, providerName),
// this just checks whether the label exists, independent from its value
ctrlutils.HasLabelPredicate(clustersv1alpha1.ProfileLabel, ""),
Copy link
Member

Choose a reason for hiding this comment

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

I suggest that we split this predicate function into two:

Suggested change
ctrlutils.HasLabelPredicate(clustersv1alpha1.ProviderLabel, providerName),
// this just checks whether the label exists, independent from its value
ctrlutils.HasLabelPredicate(clustersv1alpha1.ProfileLabel, ""),
ctrlutils.HasLabelValuePredicate(clustersv1alpha1.ProviderLabel, providerName),
// this just checks whether the label exists, independent from its value
ctrlutils.HasLabelPredicate(clustersv1alpha1.ProfileLabel),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is probably a good idea. Alternatively, we could also introduce a constant like ArbitraryValue that contains a string which is invalid as label value anyway. Both probably better than an empty string meaning "it doesn't matter".
Independent from how we improve this, I would still first change the implementation and update the documentation afterwards.

return reconcile.Result{}, nil
case apiconst.OperationAnnotationValueReconcile:
log.Debug("Removing reconcile operation annotation from resource")
if err := ctrlutils.EnsureAnnotation(ctx, myClient, obj, apiconst.OperationAnnotation, "", true, ctrlutils.DELETE); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

This might be confusing for new collaborators. Can we simplify it to some thing like this?

Suggested change
if err := ctrlutils.EnsureAnnotation(ctx, myClient, obj, apiconst.OperationAnnotation, "", true, ctrlutils.DELETE); err != nil {
if err := ctrlutils.RemoveAnnotation(ctx, myClient, obj, apiconst.OperationAnnotation); err != nil {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, the idea was that the EnsureAnnotation ensures a desired state of the annotation, either that it has a specific value or that it doesn't exist. But I have to admit that the deletion case doesn't look too nice syntactically.

@ValentinGerlach ValentinGerlach merged commit 6b0cfcc into main Sep 4, 2025
4 checks passed
@ValentinGerlach ValentinGerlach deleted the clusterprovider branch September 4, 2025 11:10
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.

3 participants