Skip to content
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

Folder permissions reconciler #821

Merged
merged 14 commits into from Sep 9, 2022

Conversation

Iridias
Copy link
Contributor

@Iridias Iridias commented Aug 29, 2022

Description

could you recreate this PR and use another branch then master?

Sure

Relevant issues/tickets

#809

@NissesSenap NissesSenap mentioned this pull request Sep 6, 2022
6 tasks
@NissesSenap
Copy link
Collaborator

@Iridias I found the issue with the e2e test. It was a simple copy-paste issue containing the rbac settings.
I have done the same error and it's easy to make since you are normally running as a cluster-admin using the make run command.

Copy link
Collaborator

@NissesSenap NissesSenap left a comment

Choose a reason for hiding this comment

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

Nit, else I think it looks good.

If you can add some docs about the new feature in https://github.com/grafana-operator/grafana-operator/blob/master/documentation/README.md that would be great.

Maybe create a new file in https://github.com/grafana-operator/grafana-operator/blob/master/documentation/ called folder.md or something like that and write a few rows about the feature.

Thanks allot for your contribution @Iridias!

// Run the actions to reach the desired state
actionRunner := common.NewClusterActionRunner(ctx, r.Client, r.Scheme, cr)
err = actionRunner.RunAll(desiredState)
if err != nil {
return r.manageError(cr, err, request)
}

log.V(1).Info("Now processing configMaps...")
Copy link
Collaborator

Choose a reason for hiding this comment

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

The reconciler loop is already rather chatty. Is it worth writing this log for every run?


var logger = logf.Log.WithName("folder-grafana-client")

// FIXME: client is not controller-specific - refactor and avoid duplications
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will be solved in version 5. You can remove the comment.

Comment on lines 33 to 34
FolderName string `json:"title"`
FolderPermissions []GrafanaPermissionItem `json:"permissions,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is kind of self explanatory but it would be nice with some extra comments explaining what the different CRD values does.
Maybe copy the description from the grafana API docs.

log.Log.Info("dashboard found but selectors do not match", "namespace", folder.Namespace, "name", folder.Name)
continue
}
// FIXME: implementation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another FIXME

return NewGrafanaClient(url, username, password, r.transport, duration), nil
}

// Handle success case: update dashboard metadata (id, uid) and update the list
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update this comment.

Copy link
Collaborator

@HubertStefanski HubertStefanski left a comment

Choose a reason for hiding this comment

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

LGTM! @Iridias thanks for implementing this.

I verified this locally on minikube, everything seems to be working as intended.

Upgrade path also works seamlessly between unmanaged folders on the main branc, to your branch, and fully transition to your logic without issues. Great job!

@HubertStefanski HubertStefanski merged commit 3884b46 into grafana:master Sep 9, 2022
@NissesSenap NissesSenap changed the title Folder permissions Folder permissions reconciler Oct 6, 2022
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.

None yet

4 participants