diff --git a/Makefile.local b/Makefile.local index e7c7afc4..d9a1d37a 100644 --- a/Makefile.local +++ b/Makefile.local @@ -111,6 +111,12 @@ deploy-external-dns: deploy-metrics-server: helm upgrade -i --repo https://kubernetes-sigs.github.io/metrics-server metrics-server metrics-server --version 3.8.3 -n kube-system --set args={--kubelet-insecure-tls} +################# +.PHONY: deploy-kube-state-metrics +deploy-kube-state-metrics: + helm upgrade -i --repo https://prometheus-community.github.io/helm-charts prometheus-operator-crds prometheus-operator-crds --version 4.0.2 + helm upgrade -i --repo https://prometheus-community.github.io/helm-charts kube-state-metrics kube-state-metrics --version 5.7.0 -n kube-system --values test-data/kube-state-metrics-values.yaml + ################# # https://kind.sigs.k8s.io/docs/user/loadbalancer/ .PHONY: deploy-metallb diff --git a/test-data/kube-state-metrics-values.yaml b/test-data/kube-state-metrics-values.yaml new file mode 100644 index 00000000..23cf4ac7 --- /dev/null +++ b/test-data/kube-state-metrics-values.yaml @@ -0,0 +1,108 @@ +resources: + limits: + cpu: 100m + memory: 64Mi + requests: + cpu: 10m + memory: 32Mi + +prometheus: + monitor: + enabled: true + +rbac: + extraRules: + - apiGroups: ["apiextensions.k8s.io"] + resources: ["customresourcedefinitions"] + verbs: ["list", "watch"] + - apiGroups: ["gateway.networking.k8s.io"] + resources: ["*"] + verbs: ["list", "watch"] + +extraArgs: +- --custom-resource-state-config +- | + spec: + resources: + - groupVersionKind: + group: gateway.networking.k8s.io + version: "v1beta1" + kind: GatewayClass + metricNamePrefix: "gatewayapi" + labelsFromPath: + name: ["metadata", "name"] + namespace: ["metadata", "namespace"] + controllerName: ["spec", "controllerName"] + metrics: + - name: gatewayclass_conditions + help: "GatewayClass conditions" + each: + type: Gauge + gauge: + path: ["status", "conditions"] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + # Zombie GatewayClasses can be detected by comparing `gatewayclass_conditions` with this + - name: gatewayclass_info + help: "GatewayClass info" + each: + type: Info + info: + labelsFromPath: + classname: ["spec", "controllerName"] + - groupVersionKind: + group: gateway.networking.k8s.io + version: "v1beta1" + kind: Gateway + metricNamePrefix: "gatewayapi" + labelsFromPath: + name: ["metadata", "name"] + namespace: ["metadata", "namespace"] + classname: ["spec", "gatewayClassName"] + metrics: + - name: gateway_conditions + help: "Gateway conditions" + each: + type: Gauge + gauge: + path: ["status", "conditions"] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + # Zombie Gateways can be detected by comparing `gateway_conditions` with this + - name: gateway_info + help: "Gateway info" + each: + type: Info + info: + labelsFromPath: + classname: ["spec", "gatewayClassName"] + - groupVersionKind: + group: gateway.networking.k8s.io + version: "v1beta1" + kind: HTTPRoute + metricNamePrefix: "gatewayapi" + labelsFromPath: + name: ["metadata", "name"] + namespace: ["metadata", "namespace"] + metrics: + - name: httproute_conditions + help: "HTTPRoute conditions" + each: + type: Gauge + gauge: + # This will not work for HTTPRoutes attached to multiple parents + path: ["status", "parents", "0", "conditions"] + labelsFromPath: + type: ["type"] + valueFrom: ["status"] + # Zombie HTTPRoutes can be detected by comparing `httproute_conditions` with this + - name: httproute_info + help: "HTTPRoute " + each: + type: Info + info: + labelsFromPath: + classname: ["spec", "parentRefs", "0"] +- --custom-resource-state-only=true