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

Reconcile the pyrra generated prometheusrule crs with azure prometheusrulegroups resources #1110

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

monteiro-renato
Copy link
Contributor

@monteiro-renato monteiro-renato commented Nov 13, 2024

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

kubebuilder init --domain dis.altinn.cloud --repo github.com/Altinn/altinn-platform/services/dis-promrulegroups-operator
make build-installer
kubebuilder create api --group monitoring.coreos.com --version v1 --kind PrometheusRule --controller --resource=false --external-api-path="github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
make build-installer
rename monitoringcoreoscomv1 to monitoringv1
make build-installer
basic tests
go mod tidy
Copy link

coderabbitai bot commented Nov 13, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@@ -0,0 +1,259 @@
apiVersion: v1
Copy link
Collaborator

Choose a reason for hiding this comment

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

was the dist folder pushed by mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Intentional, it's to show which changes I made to what's generated.

@sduranc
Copy link
Collaborator

sduranc commented Nov 14, 2024

Wow, this is a long PR. Not sure I'll get time this week to review it. I find the name a bit odd (yeah, naming's hard), It makes more sense to have a "wider" operator and include this as a controller, e.g slo operator, observability operator, etc.

@monteiro-renato
Copy link
Contributor Author

I made sure to make multiple commits to make it easier to review.
You can ignore the first three commits as that's all generated stuff.
The fourth commit onwards show the actual changes I've made.

@monteiro-renato
Copy link
Contributor Author

Regarding the naming, I think we should keep this controller separate from other eventual controllers we build. This is mostly to address a limitation we've faced when moving from kube-prometheus to the Azure managed Prometheus. Ideally, Azure will provide a native way to do this in the future and we can simply stop using this controller.

Copy link
Member

@tjololo tjololo left a comment

Choose a reason for hiding this comment

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

Sorry for the lat review! Commented some of my thoughts

services/dis-promrulegroups-operator/Dockerfile.bak Outdated Show resolved Hide resolved
Comment on lines +71 to +77
if os.Getenv("ENVIRONMENT") == "" {
err := godotenv.Load()
if err != nil {
setupLog.Error(err, "Error loading .env file")
os.Exit(1)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This is a NIT!
I have used koanf in my operator, but the work is not worth it if we think this operator is going to be undeployed soon.
My koanf config loading: https://github.com/Altinn/altinn-platform/blob/main/services/dis-apim-operator/internal/config/conf.go

Copy link
Member

Choose a reason for hiding this comment

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

add this workflows to the repo workflows folder so they get triggered. Remember to add path limitations so it only run when changes to this operator or pipeline is pushed

Copy link
Member

Choose a reason for hiding this comment

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

add this workflows to the repo workflows folder, if e2e tests are implemented, so they get triggered. Remember to add path limitations so it only run when changes to this operator or pipeline is pushed

Copy link
Member

Choose a reason for hiding this comment

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

add this workflows to the repo workflows folder so they get triggered. Remember to add path limitations so it only run when changes to this operator or pipeline is pushed

for _, rn := range strings.Split(resourceNames, ",") {
_, err := r.deletePrometheusRuleGroup(ctx, rn)
if err != nil {
// TODO: Should we try to delete the rest in case one deletion fails? Or simply retry again?
Copy link
Member

Choose a reason for hiding this comment

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

Might be good idea to try to delete the rest and then return an err. If we just retry/requeue this would block all the resources later in the slice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here: fd2b33c

Copy link
Member

@tjololo tjololo left a comment

Choose a reason for hiding this comment

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

One small question and a nit, other than that it looks good.
Is this still a draft?

name: selfsigned-issuer
secretName: webhook-server-cert
{{- end }}
{{- if and .Values.metrics.enable .Values.certmanager.enable }}
Copy link
Member

Choose a reason for hiding this comment

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

NIT
Probably generated code, the check .Values.certmanager.enable seems unnecessary as the outer most if already has checked that it is true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generated code indeed.
One of the {{end}} blocks should be further up.

services/dis-promrulegroups-operator/Dockerfile Outdated Show resolved Hide resolved
@monteiro-renato
Copy link
Contributor Author

One small question and a nit, other than that it looks good. Is this still a draft?

I guess it's not a draft anymore; I've tested it by deploying manually to two AT clusters (I cleaned up after myself don't worry :)).
Do we have any place I can use to push the image and the helm chart to?
If I can do that, I can use the helm provider and deploy this to the AT environments to get some "real world" testing.

@tjololo
Copy link
Member

tjololo commented Dec 10, 2024

One small question and a nit, other than that it looks good. Is this still a draft?

I guess it's not a draft anymore; I've tested it by deploying manually to two AT clusters (I cleaned up after myself don't worry :)). Do we have any place I can use to push the image and the helm chart to? If I can do that, I can use the helm provider and deploy this to the AT environments to get some "real world" testing.

I suggest we use the github registry and then push to a private registry as well, or use a private cache for the Image.
We have a repo for other helm charts here: github.com/Altinn/altinn-studio-charts but that don't seem like a good match. Is it possible to use ghcr.io for helm charts as well?

@monteiro-renato
Copy link
Contributor Author

monteiro-renato commented Dec 10, 2024

One small question and a nit, other than that it looks good. Is this still a draft?

I guess it's not a draft anymore; I've tested it by deploying manually to two AT clusters (I cleaned up after myself don't worry :)). Do we have any place I can use to push the image and the helm chart to? If I can do that, I can use the helm provider and deploy this to the AT environments to get some "real world" testing.

I suggest we use the github registry and then push to a private registry as well, or use a private cache for the Image. We have a repo for other helm charts here: github.com/Altinn/altinn-studio-charts but that don't seem like a good match. Is it possible to use ghcr.io for helm charts as well?

Never actually tried it but I suppose it should be possible yea. I, however, don't have the required permissions to make the setup work. This would require us to make configuration changes in Github and in our Terraform pipelines. I guess no one with the needed permissions would have the time to work on this now 😅 .

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