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
Bug 1904578: Configure metrics scraping #107
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
manifests/0000_90_cluster-storage-operator_01_prometheusrbac.yaml
This file contains 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,32 @@ | ||
# Role for accessing metrics exposed by the cluster-storage-operator | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: prometheus | ||
namespace: openshift-cluster-storage-operator | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- services | ||
- endpoints | ||
- pods | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
--- | ||
# Grant cluster-monitoring access to openshift-cluster-storage-operator metrics | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: prometheus | ||
namespace: openshift-cluster-storage-operator | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: prometheus | ||
subjects: | ||
- kind: ServiceAccount | ||
name: prometheus-k8s | ||
namespace: openshift-monitoring |
49 changes: 49 additions & 0 deletions
49
manifests/0000_90_cluster-storage-operator_02_servicemonitor.yaml
This file contains 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,49 @@ | ||
# Configure cluster-monitoring for cluster-storage-operator | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: cluster-storage-operator | ||
namespace: openshift-cluster-storage-operator | ||
annotations: | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 30s | ||
path: /metrics | ||
port: https | ||
scheme: https | ||
tlsConfig: | ||
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt | ||
serverName: cluster-storage-operator-metrics.openshift-cluster-storage-operator.svc | ||
jobLabel: component | ||
selector: | ||
matchLabels: | ||
app: cluster-storage-operator-metrics | ||
|
||
--- | ||
|
||
# Configure cluster-monitoring for vsphere-problem-detector | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: vsphere-problem-detector | ||
namespace: openshift-cluster-storage-operator | ||
annotations: | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 30s | ||
path: /metrics | ||
port: https | ||
scheme: https | ||
tlsConfig: | ||
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt | ||
serverName: vsphere-problem-detector-metrics.openshift-cluster-storage-operator.svc | ||
jobLabel: component | ||
selector: | ||
matchLabels: | ||
app: vsphere-problem-detector-metrics |
This file contains 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 |
---|---|---|
|
@@ -9,3 +9,4 @@ metadata: | |
spec: | ||
managementState: Managed | ||
logLevel: Normal | ||
operatorLogLevel: Normal |
This file contains 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,47 @@ | ||
# Expose operator metrics | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
service.alpha.openshift.io/serving-cert-secret-name: cluster-storage-operator-serving-cert | ||
labels: | ||
app: cluster-storage-operator-metrics | ||
name: cluster-storage-operator-metrics | ||
namespace: openshift-cluster-storage-operator | ||
spec: | ||
ports: | ||
- name: https | ||
port: 443 | ||
protocol: TCP | ||
targetPort: 8443 | ||
selector: | ||
name: cluster-storage-operator | ||
sessionAffinity: None | ||
type: ClusterIP | ||
|
||
--- | ||
|
||
# Expose vsphere-problem-detector metrics | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
include.release.openshift.io/ibm-cloud-managed: "true" | ||
include.release.openshift.io/self-managed-high-availability: "true" | ||
service.alpha.openshift.io/serving-cert-secret-name: vsphere-problem-detector-serving-cert | ||
labels: | ||
app: vsphere-problem-detector-metrics | ||
name: vsphere-problem-detector-metrics | ||
namespace: openshift-cluster-storage-operator | ||
spec: | ||
ports: | ||
- name: https | ||
port: 443 | ||
protocol: TCP | ||
targetPort: 8444 | ||
selector: | ||
name: cluster-storage-operator | ||
sessionAffinity: None | ||
type: ClusterIP |
This file contains 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
File renamed without changes.
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.
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.
I think CSO's metric setup is busted. In deployment we say:
And then since we don't specify port in startup command, it will default to 8443, but then where does 443 comes from?
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.
8443
is where library-go listens: https://github.com/openshift/library-go/blob/9821002633e882489381e51d1bb4442788c0c01f/pkg/config/configdefaults/config_default.go#L46.443
is where we want to expose the metrics service.Good point about the
containerPort
, fixed to 8443.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.
we as such don't have to change the port I think. We can as well leave it same as target port.