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

NETOBSERV-2107: fix service monitor quotes #166

Merged
merged 5 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions res/metric-capture.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ spec:
value: "false"
- name: LOG_LEVEL
value: info
- name: INTERFACES
value: ""
- name: EXCLUDE_INTERFACES
value: "lo"
- name: SAMPLING
value: "1"
- name: ENABLE_RTT
value: "false"
- name: ENABLE_PKT_DROPS
value: "false"
- name: ENABLE_DNS_TRACKING
value: "false"
- name: ENABLE_NETWORK_EVENTS_MONITORING
value: "false"
- name: ENABLE_UDN_MAPPING
value: "false"
- name: ENABLE_PKT_TRANSLATION
value: "false"
- name: ENABLE_FLOW_FILTER
value: "false"
- name: FLOW_FILTER_RULES
value: >-
[]
Expand Down Expand Up @@ -65,21 +85,4 @@ spec:
- name: var-run-ovs
hostPath:
path: /var/run/openvswitch
type: DirectoryOrCreate
---
kind: Service
apiVersion: v1
metadata:
name: netobserv-cli
namespace: "{{NAMESPACE}}"
labels:
app: netobserv-cli
spec:
ports:
- name: prometheus
protocol: TCP
port: 9401
targetPort: 9401
selector:
app: netobserv-cli
type: ClusterIP
type: DirectoryOrCreate
36 changes: 36 additions & 0 deletions res/service-account.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,39 @@ roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: netobserv-cli
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: netobserv-cli-metrics
namespace: "{{NAMESPACE}}"
rules:
# allow openshift-monitoring metrics reading
- apiGroups:
- ''
resources:
- pods
- services
- endpoints
verbs:
- list
- get
- watch
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: netobserv-cli-metrics
namespace: "{{NAMESPACE}}"
Copy link
Member

Choose a reason for hiding this comment

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

not a blocker, but it doesn't make sense to set namespace on a clusterrolebinding (same for clusterrole) - it will work but will be ignored afaik

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ultimately I would like to rely on Role / RoleBinding here but it doesn't seems to work

Let's keep as is for this release and we'll investigate

subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: netobserv-cli-metrics
31 changes: 24 additions & 7 deletions res/service-monitor.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function loadYAMLs() {
if [ -f ./res/metric-capture.yml ]; then
metricAgentYAML="$(cat ./res/metric-capture.yml)"
fi
metricAgentYAML="${metricAgentYAML//"{{NAMESPACE}}"/${namespace}}"
metricAgentYAML="${metricAgentYAML/"{{NAMESPACE}}"/${namespace}}"
metricAgentYAML="${metricAgentYAML/"{{AGENT_IMAGE_URL}}"/${agentImg}}"

collectorServiceYAML='
Expand Down