-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
sriov-network-metrics-exporter
Deploy `sriov-network-metrics-exporter` DaemonSet and related configuration. The feature is activated by the feature gate `metricsExporter`. Add deployment logic to the SriovOperatorConfig reconcile loop. The operator's environment variable `SRIOV_NETWORK_METRICS_EXPORTER_IMAGE` controls the exporter image to deploy. Update helm charts with `.Values.images.metricsExporter` with the same semantic. Signed-off-by: Andrea Panattoni <[email protected]>
- Loading branch information
Showing
15 changed files
with
429 additions
and
12 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
bindata/manifests/metrics-exporter/metrics-config-map.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,12 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: sriov-network-metrics-exporter-config | ||
namespace: {{.Namespace}} | ||
data: | ||
drivers.yaml: |- | ||
drivers: | ||
- name: ice | ||
version: 1.0.0 | ||
- name: mlx5_core | ||
version: 1.0.0 |
122 changes: 122 additions & 0 deletions
122
bindata/manifests/metrics-exporter/metrics-daemonset.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,122 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
labels: | ||
app: sriov-network-metrics-exporter | ||
name: sriov-network-metrics-exporter | ||
namespace: {{.Namespace}} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: sriov-network-metrics-exporter | ||
template: | ||
metadata: | ||
labels: | ||
app: sriov-network-metrics-exporter | ||
spec: | ||
hostNetwork: true | ||
serviceAccountName: sriov-network-config-daemon | ||
{{- if .ImagePullSecrets }} | ||
imagePullSecrets: | ||
{{- range .ImagePullSecrets }} | ||
- name: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
- args: | ||
- --web.listen-address=127.0.0.1:{{.MetricsExporterPort}} | ||
- --path.kubecgroup=/sys/fs/cgroup | ||
- --path.sysbuspci=/host/sys/bus/pci/devices/ | ||
- --path.sysclassnet=/host/sys/class/net/ | ||
- --path.cpucheckpoint=/host/cpu_manager_state | ||
- --path.kubeletsocket=/host/kubelet.sock | ||
- --collector.kubepoddevice=true | ||
- --collector.vfstatspriority=sysfs,netlink | ||
image: {{.Image}} | ||
imagePullPolicy: IfNotPresent | ||
name: metrics-exporter | ||
resources: | ||
requests: | ||
memory: 100Mi | ||
cpu: 100m | ||
securityContext: | ||
capabilities: | ||
drop: | ||
- ALL | ||
readOnlyRootFilesystem: true | ||
allowPrivilegeEscalation: false | ||
volumeMounts: | ||
- mountPath: /host/kubelet.sock | ||
name: kubeletsocket | ||
- mountPath: /host/sys/bus/pci/devices | ||
name: sysbuspcidevices | ||
readOnly: true | ||
- mountPath: /host/sys/devices | ||
name: sysdevices | ||
readOnly: true | ||
- mountPath: /host/sys/class/net | ||
name: sysclassnet | ||
readOnly: true | ||
- mountPath: /host/cpu_manager_state | ||
name: cpucheckpoint | ||
readOnly: true | ||
- name: sriov-network-metrics-exporter-config | ||
mountPath: /etc/sriov-network-metrics-exporter | ||
- name: kube-rbac-proxy | ||
image: '{{.KubeRbacProxyImage}}' | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- --logtostderr | ||
- --secure-listen-address=[$(HOST_IP)]:{{.MetricsExporterPort}} | ||
- --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 | ||
- --upstream=http://127.0.0.1:{{.MetricsExporterPort}}/ | ||
- --tls-private-key-file=/etc/metrics/tls.key | ||
- --tls-cert-file=/etc/metrics/tls.crt | ||
ports: | ||
- containerPort: {{.MetricsExporterPort}} | ||
name: https-metrics | ||
env: | ||
- name: HOST_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.hostIP | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 20Mi | ||
volumeMounts: | ||
- name: metrics-certs | ||
mountPath: /etc/metrics | ||
readOnly: true | ||
nodeSelector: | ||
kubernetes.io/os: linux | ||
node-role.kubernetes.io/worker: "" | ||
restartPolicy: Always | ||
volumes: | ||
- hostPath: | ||
path: /var/lib/kubelet/pod-resources/kubelet.sock | ||
type: "Socket" | ||
name: kubeletsocket | ||
- hostPath: | ||
path: /var/lib/kubelet/cpu_manager_state | ||
type: "File" | ||
name: cpucheckpoint | ||
- hostPath: | ||
path: /sys/class/net | ||
type: "Directory" | ||
name: sysclassnet | ||
- hostPath: | ||
path: /sys/bus/pci/devices | ||
type: "Directory" | ||
name: sysbuspcidevices | ||
- hostPath: | ||
path: /sys/devices | ||
type: "Directory" | ||
name: sysdevices | ||
- name: sriov-network-metrics-exporter-config | ||
configMap: | ||
name: sriov-network-metrics-exporter-config | ||
- name: metrics-certs | ||
secret: | ||
defaultMode: 420 | ||
secretName: {{ .MetricsExporterSecretName }} |
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,66 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: metrics-exporter-sa | ||
namespace: {{.Namespace}} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: metrics-exporter-role | ||
namespace: {{.Namespace}} | ||
rules: | ||
- apiGroups: | ||
- security.openshift.io | ||
resourceNames: | ||
- hostaccess | ||
resources: | ||
- securitycontextconstraints | ||
verbs: | ||
- use | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: metrics-exporter-rb | ||
namespace: {{.Namespace}} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: metrics-exporter-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: metrics-exporter-sa | ||
namespace: {{.Namespace}} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: sriov-metrics-kube-rbac-role | ||
rules: | ||
- apiGroups: | ||
- authentication.k8s.io | ||
resources: | ||
- tokenreviews | ||
verbs: | ||
- create | ||
- apiGroups: | ||
- authorization.k8s.io | ||
resources: | ||
- subjectaccessreviews | ||
verbs: | ||
- create | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: sriov-metrics-kube-rbac-rolebinding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: sriov-metrics-kube-rbac-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: metrics-exporter-sa | ||
namespace: {{.Namespace}} |
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,18 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: sriov-network-metrics-exporter-service | ||
namespace: {{.Namespace}} | ||
annotations: | ||
prometheus.io/target: "true" | ||
service.beta.openshift.io/serving-cert-secret-name: {{ .MetricsExporterSecretName }} | ||
labels: | ||
name: sriov-network-metrics-exporter-service | ||
spec: | ||
selector: | ||
app: sriov-network-metrics-exporter | ||
ports: | ||
- protocol: TCP | ||
name: sriov-network-metrics | ||
port: {{ .MetricsExporterPort }} | ||
targetPort: {{ .MetricsExporterPort }} |
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
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
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
Oops, something went wrong.