Skip to content
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
37 changes: 37 additions & 0 deletions kube-state-metrics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
This directory contains configuration files for enabling
[kube-state-metrics](https://github.com/kubernetes/kube-state-metrics/)
to report metrics for AppWrappers.

The file [appwrapper-ksm-cm.yaml](./appwrapper-ksm-cm.yaml) defines
a configuration map that can be volume-mounted into the
kube-state-metrics pod and passed via the `--custom-resource-state-config-file`
command line argument. For development of the AppWrapper metrics,
you may want to add `--custom-resource-state-only=true` to the command
line arguments to suppress generation of metrics for built-in types.

The file [appwrapper-ksm-rbac.yaml](./appwrapper-ksm-rbac.yaml) defines
a clusterrole and clusterrolebinding that add the RBACs
needed to collect AppWrapper metrics to the `kube-state-metrics` service account.
Alternatively, you could edit the existing kube-state-metrics clusterrole to
add these permissions.

The changes to the kube-state-metrics deployment are roughly as shown below:
```yaml
...
spec:
containers:
- args:
- --custom-resource-state-config-file=/appwrapper_ksm.yaml
...
volumeMounts:
- mountPath: /appwrapper_ksm.yaml
name: appwrapper-ksm
readOnly: true
subPath: appwrapper_ksm.yaml
...
volumes:
- configMap:
defaultMode: 420
name: appwrapper-ksm
name: appwrapper-ksm
```
32 changes: 32 additions & 0 deletions kube-state-metrics/appwrapper-ksm-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kube-state-metrics-appwrapper
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kube-state-metrics-appwrapper
subjects:
- kind: ServiceAccount
name: kube-state-metrics
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kube-state-metrics-appwrapper
rules:
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- list
- watch
- apiGroups:
- workload.codeflare.dev
resources:
- appwrappers
verbs:
- list
- watch