-
Notifications
You must be signed in to change notification settings - Fork 26
NE-2840: Enable ServiceMonitor for Prometheus metrics scraping #319
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
Merged
+120
−3
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
bundle/manifests/aws-load-balancer-operator-cabundle_v1_configmap.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| annotations: | ||
| service.beta.openshift.io/inject-cabundle: "true" | ||
| name: aws-load-balancer-operator-cabundle |
24 changes: 24 additions & 0 deletions
24
...-operator-controller-manager-metrics-monitor_monitoring.coreos.com_v1_servicemonitor.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: ServiceMonitor | ||
| metadata: | ||
| labels: | ||
| control-plane: controller-manager | ||
| name: aws-load-balancer-operator-controller-manager-metrics-monitor | ||
| spec: | ||
| endpoints: | ||
| - authorization: | ||
| credentials: | ||
| key: token | ||
| name: aws-load-balancer-operator-metrics-scraper-token | ||
| path: /metrics | ||
| port: https | ||
| scheme: https | ||
| tlsConfig: | ||
| ca: | ||
| configMap: | ||
| key: service-ca.crt | ||
| name: aws-load-balancer-operator-cabundle | ||
| serverName: aws-load-balancer-operator-controller-manager-metrics-service.aws-load-balancer-operator.svc | ||
| selector: | ||
| matchLabels: | ||
| control-plane: controller-manager |
2 changes: 2 additions & 0 deletions
2
...e/manifests/aws-load-balancer-operator-controller-manager-metrics-service_v1_service.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
bundle/manifests/aws-load-balancer-operator-metrics-scraper-token_v1_secret.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| annotations: | ||
| kubernetes.io/service-account.name: aws-load-balancer-operator-metrics-scraper | ||
| name: aws-load-balancer-operator-metrics-scraper-token | ||
| type: kubernetes.io/service-account-token |
13 changes: 13 additions & 0 deletions
13
...ad-balancer-operator-metrics-scraper_rbac.authorization.k8s.io_v1_clusterrolebinding.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: aws-load-balancer-operator-metrics-scraper | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: aws-load-balancer-operator-metrics-reader | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: aws-load-balancer-operator-metrics-scraper | ||
| namespace: aws-load-balancer-operator | ||
5 changes: 5 additions & 0 deletions
5
bundle/manifests/aws-load-balancer-operator-metrics-scraper_v1_serviceaccount.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: aws-load-balancer-operator-metrics-scraper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: metrics-scraper | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: metrics-reader | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: metrics-scraper | ||
| namespace: system |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: metrics-scraper-token | ||
| namespace: system | ||
| annotations: | ||
| kubernetes.io/service-account.name: aws-load-balancer-operator-metrics-scraper | ||
| type: kubernetes.io/service-account-token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: metrics-scraper | ||
| namespace: system | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/aws-load-balancer-operator
Length of output: 9501
🏁 Script executed:
Repository: openshift/aws-load-balancer-operator
Length of output: 21013
🏁 Script executed:
Repository: openshift/aws-load-balancer-operator
Length of output: 49822
🏁 Script executed:
Repository: openshift/aws-load-balancer-operator
Length of output: 988
🌐 Web query:
OLM ClusterServiceVersion AllNamespaces install mode installation namespace bundle manifests namespace substitution behavior💡 Result:
In the Operator Lifecycle Manager (OLM), the AllNamespaces install mode indicates that an Operator is designed to be cluster-scoped, allowing it to watch and manage resources across all namespaces in a cluster [1][2][3]. Regarding bundle manifests and namespace substitution: 1. Namespace-Aware Manifests: When an Operator is designed to support AllNamespaces mode, its deployment manifests—such as those defining Deployments, Roles, or RoleBindings—often need to handle the Operator's namespace dynamically [4]. Since the Operator may be installed in any namespace chosen by a cluster administrator, hardcoding the installation namespace in manifest files is often problematic [4]. 2. Substitution Behavior: OLM does not automatically perform a generic string-replacement substitution on arbitrary fields within your bundle manifests. Instead, Operator authors frequently implement this behavior themselves within their build or CI/CD pipelines [4][5]. Common practices include: - Using placeholders (e.g., {{.Namespace}} or similar patterns) in YAML manifests [4]. - Utilizing environment variables (like OPERATOR_NAMESPACE) inside the operator pod to dynamically discover the namespace in which it is running [4]. - Using build tools to inject the actual target namespace into these manifests during the bundle creation process [4]. 3. RBAC Generation: When an Operator supports AllNamespaces mode and is installed via an OperatorGroup that targets all namespaces, OLM manages the necessary permissions by generating cluster-wide RBAC resources (ClusterRoles and ClusterRoleBindings) rather than namespace-scoped ones [6]. This ensures the Operator has the required access across the cluster to perform its functions [6]. To successfully deploy an operator in AllNamespaces mode, you must explicitly set
supported: truefor theAllNamespacestype in theinstallModessection of your ClusterServiceVersion (CSV) [7][8][9]. When installing, you must also create an OperatorGroup that targets all namespaces (typically by settingspec.targetNamespacesto an empty list or omitting it for a global OperatorGroup) [2][10][11]. If the CSV and OperatorGroup configurations do not align, the CSV will transition to a failed state (e.g.,UnsupportedOperatorGroup) [2][12].Citations:
installModeoperator-framework/operator-lifecycle-manager#1487🌐 Web query:
Operator Lifecycle Manager bundle manifests additional resources installed directly ClusterServiceVersion bundle manifests💡 Result:
In the Operator Lifecycle Manager (OLM), an Operator bundle is a container image that packages the manifests required to install an operator [1][2]. The bundle typically contains a ClusterServiceVersion (CSV), CustomResourceDefinitions (CRDs), and additional Kubernetes resources [1][2][3]. You can include additional Kubernetes objects alongside the CSV in the bundle's /manifests directory [2][3]. These manifests are installed directly by OLM when the bundle is deployed [2][3]. Supported resources that can be included in the bundle manifests include: - Secret - ClusterRole and ClusterRoleBinding - ConfigMap - ServiceAccount - Service - Role and RoleBinding - PrometheusRule - ServiceMonitor - PodDisruptionBudget - PriorityClass - VerticalPodAutoscaler - ConsoleYAMLSample, ConsoleQuickStart, ConsoleCLIDownload, and ConsoleLink [3] These resources are processed as part of the bundle installation process [2][3]. It is important to note that some objects (such as PriorityClass) have cluster-wide implications and should be used with caution as they may affect workloads outside of the operator [3]. Alternatively, many operator authors prefer to have the operator itself create or manage these resources during its runtime via the Kubernetes API, rather than bundling them as static manifests [4][5]. This approach often provides the operator with more control over the lifecycle, configuration, and reconciliation of those resources [4][5].
Citations:
Resolve hard-coded installation namespaces in the bundle.
This CSV supports
AllNamespaces, but OLM does not rewrite arbitrary manifest fields. The scraper binding, CRD webhook, and metricsserverNameuseaws-load-balancer-operator, while namespace-scoped resources use the selected installation namespace. Installations elsewhere can cause metrics403responses and webhook failures. Parameterize these references and regenerate the bundle.🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
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.
@coderabbitai: yes, this is a known limitation, ALBO is made for
aws-load-balancer-operatornamespace only. We can address this but not in this PR.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.
@alebedev87, thanks for the clarification.The hard-coded namespace is valid if ALBO supports only
aws-load-balancer-operator.However, the CSV advertises
AllNamespaces. That mode conflicts with this installation constraint. Please either remove unsupported install modes from the CSV or make the bundle namespace-independent.✏️ Learnings added
You are interacting with an AI system.
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.
@coderabbitai: I agree that the gap exists. However I won't fix it in this PR, we'll have to reserve this for future.
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.
@alebedev87, acknowledged. The finding remains open for this pull request.Would you like me to create a GitHub follow-up issue to align the CSV install modes with the fixed
aws-load-balancer-operatornamespace requirement?🧠 Learnings used
You are interacting with an AI system.