-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
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
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
@@ -0,0 +1,259 @@ | |||
apiVersion: v1 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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. |
I made sure to make multiple commits to make it easier to review. |
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. |
… monitoring subscription
There was a problem hiding this 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
if os.Getenv("ENVIRONMENT") == "" { | ||
err := godotenv.Load() | ||
if err != nil { | ||
setupLog.Error(err, "Error loading .env file") | ||
os.Exit(1) | ||
} | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
services/dis-promrulegroups-operator/internal/controller/prometheusrule_controller.go
Show resolved
Hide resolved
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? |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here: fd2b33c
services/dis-promrulegroups-operator/internal/controller/prometheusrule_controller.go
Outdated
Show resolved
Hide resolved
services/dis-promrulegroups-operator/internal/controller/prometheusrule_controller.go
Outdated
Show resolved
Hide resolved
services/dis-promrulegroups-operator/internal/controller/prometheusrule_controller.go
Show resolved
Hide resolved
There was a problem hiding this 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 }} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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/internal/controller/prometheusrule_controller.go
Show resolved
Hide resolved
services/dis-promrulegroups-operator/internal/controller/prometheusrule_controller.go
Show resolved
Hide resolved
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 :)). |
I suggest we use the github registry and then push to a private registry as well, or use a private cache for the Image. |
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 😅 . |
Related Issue(s)
Verification