Add monitoring controller for metrics - #1959
mayleighnmyers wants to merge 27 commits into
Conversation
|
Hi @mayleighnmyers. Thanks for your PR. I'm waiting for a istio-ecosystem or istio member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Hi @mayleighnmyers, How would users control this if they wanted to opt in or out? What will the API be for this? You can either open an issue and we can discuss it there or better yet create a SEP for this. We need to discuss how this will integrate with the operator before we can move forward with this. |
So this is still in progress. Good call for the opt in/out. Something we can consider is adding a field either in the Istio CR or the istioRevision CR to allow users to opt in since right now it is currently always enabled. Yuanlin and I will be talking about this more in some future meeting when we have all ducks in a row. :) |
|
The implementation of this broadly looks fine but I think the API will need to be larger than a boolean and will require the sail operator to have additional permissions which may not be relevant for non-openshift users. With There could be a standalone Here This could even be its own deployment with its own ServiceAccount so that the Sail Operator wouldn't need to be granted additional permissions. Since a lot of the integrations may be OSSM specific, it may even make more sense to only have this available in Server side apply can ensure that any updates that the integrations controller makes to the The implementation included here would largely stay the same. The main change would be in the API to manage these integrations. |
22566a7 to
c43fabb
Compare
c43fabb to
21661f3
Compare
795caee to
3373e36
Compare
25aa652 to
3c63e82
Compare
|
/test scorecard |
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Yuanlin Xu <yuanlin.xu@redhat.com> Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Yuanlin Xu <yuanlin.xu@redhat.com>
Signed-off-by: Yuanlin Xu <yuanlin.xu@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
The gencheck job runs make gen, which updates bundle manifests from chart CRDs. The bundle copy of sailoperator.io_istios.yaml was missing the new spec.monitoring schema added for the monitoring controller. Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
Signed-off-by: Mayleigh Tjapkes <mamyers@redhat.com>
5d0d01c to
134238e
Compare
|
/retest |
nrfox
left a comment
There was a problem hiding this comment.
A few minor comments otherwise LGTM
| if tt.expectSMRevision != "" { | ||
| sm := &monitoringv1.ServiceMonitor{} | ||
| sm.SetGroupVersionKind(monitoringv1.SchemeGroupVersion.WithKind("ServiceMonitor")) | ||
| err := cl.Get(ctx, types.NamespacedName{ | ||
| Name: tt.expectSMRevision + serviceMonitorNameSuffix, | ||
| Namespace: istioNamespace, | ||
| }, sm) | ||
| g.Expect(err).ToNot(HaveOccurred()) | ||
| g.Expect(sm.Name).To(Equal(tt.expectSMRevision + serviceMonitorNameSuffix)) | ||
| expectMonitoringLabels(g, sm.Labels, serviceMonitorMonitoring) | ||
| } |
There was a problem hiding this comment.
Seems like we need an else here to check the negative conditions where we don't expect the service monitor to exist?
| if tt.expectPMNamespace != "" { | ||
| pm := &monitoringv1.PodMonitor{} | ||
| pm.SetGroupVersionKind(monitoringv1.SchemeGroupVersion.WithKind("PodMonitor")) | ||
| err := cl.Get(ctx, types.NamespacedName{ | ||
| Name: istioName + podMonitorNameSuffix, | ||
| Namespace: tt.expectPMNamespace, | ||
| }, pm) | ||
| g.Expect(err).ToNot(HaveOccurred()) | ||
| g.Expect(pm.Name).To(Equal(istioName + podMonitorNameSuffix)) | ||
| expectMonitoringLabels(g, pm.Labels, podMonitorMonitoring) | ||
| g.Expect(pm.OwnerReferences).To(HaveLen(1)) | ||
| g.Expect(pm.OwnerReferences[0].Kind).To(Equal(v1.IstioKind)) | ||
| g.Expect(pm.OwnerReferences[0].Name).To(Equal(istioName)) | ||
| g.Expect(pm.OwnerReferences[0].Controller).ToNot(BeNil()) | ||
| g.Expect(*pm.OwnerReferences[0].Controller).To(BeTrue()) | ||
| } |
| { | ||
| ObjectMeta: revisionMeta, | ||
| Spec: v1.IstioRevisionSpec{ | ||
| Version: "v1.24.0", |
There was a problem hiding this comment.
Why is the version for Istio v1.29.2 and the version of the IstioRevision v1.24.0? It may not affect the tests but looks odd. You may not need to specify the version at all. It should get defaulted.
| } | ||
| } | ||
|
|
||
| func TestReconcilePodMonitors(t *testing.T) { |
There was a problem hiding this comment.
Are these tests duplicates of TestReconcile?
| OwnerReferences: []metav1.OwnerReference{ | ||
| { | ||
| APIVersion: v1.GroupVersion.String(), | ||
| Kind: v1.IstioRevisionKind, |
There was a problem hiding this comment.
Shouldn't this be the Istio resource and not the IstioRevision similar to the PodMonitor?
| helm repo add prometheus-community https://prometheus-community.github.io/helm-charts --force-update | ||
| helm repo update | ||
|
|
||
| # Admission webhooks require a certgen Job that talks to the webhook Service. On KinD | ||
| # that Job frequently times out (the webhook Service is not reachable until kube-proxy | ||
| # is healthy), which would also make helm --wait hang. The monitoring e2e only needs CRDs | ||
| # and scrape targets, so webhooks are disabled. --wait then tracks the operator Deployment. | ||
| helm install "${PROM_RELEASE}" prometheus-community/kube-prometheus-stack \ |
There was a problem hiding this comment.
Doing helm repo add and helm repo update will have side effects on the machine this hack script is run on. Can you install the helm chart using --repo and the url directly?
There was a problem hiding this comment.
We'll probably want to expose a util package for installing the integration dependencies and handling the differences between helm vs. OLM but just keep this as is for now.
Summary
Implements SEP8471: a monitoring controller that automatically creates Prometheus Operator
ServiceMonitorandPodMonitorresources so Istio control-plane and sidecar metrics can be scraped without manual Prometheus ConfigMap edits.Opt-in via annotation on the
IstioCR:Relates to: OSSM-15085
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Related Issue/PR # OSSM-15085
Additional information: