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

Added OpenShift specific permissions to set custom host for route #644

Merged
merged 2 commits into from
Dec 8, 2021

Conversation

xt99
Copy link
Contributor

@xt99 xt99 commented Dec 3, 2021

Description

When using custom host for Grafana's ingress at OpenShift, Grafana provisioning is failing with insufficient permissions error:

apiVersion: integreatly.org/v1alpha1
kind: Grafana
metadata:
  name: grafana
spec:
  ingress:
    enabled: true
    hostname: grafana.apps.openshift-cluster.com  # <-- custom host
  ...
status:
  message: >-
    Route.route.openshift.io "grafana-route" is invalid: spec.host: Forbidden:
    you do not have permission to set the host field of the route
  phase: failing

To allow Grafana's controller to edit custom host in OpenShift's routes, it should have access to routes/custom-host resource.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • This change requires a documentation update
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a test case that will be used to verify my changes
  • Verified independently on a cluster by reviewer

Verification steps

  1. Install Grafana Operator from OpenShift's Operator Hub (v4.1.0 at the moment)
  2. Create Grafana CR with custom spec.ingress.hostname
  3. Grafana instance will not be created because of insufficient permissions

@NissesSenap
Copy link
Collaborator

Thanks for the PR @xt99 , the CI while fail though. Please run make test and it run a bunch of scripts and update a bunch of yaml files for you.
Commit them all and it should pass :)
Note that we are currently building the operator using golang 1.16, if you are using 1.17 locally you will get a question about adding: +//go:build !ignore_autogenerated to api/integreatly/v1alpha1/zz_generated.deepcopy.go, don't add this change it will make the CI fail.

We should upgrade the go version some day soon so people don't have to think about this.

@xt99
Copy link
Contributor Author

xt99 commented Dec 3, 2021

Thanks, @NissesSenap! I've added missed YAMLs and tests are passing locally via make test

Copy link
Collaborator

@hubeadmin hubeadmin left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for contributing!

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