-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-520] Added kube-state-metrics support
1. Can take customized endpoint . 2. Can install kube-state-metrics along with the platform.
- Loading branch information
1 parent
470f0f4
commit 89f8543
Showing
8 changed files
with
347 additions
and
1 deletion.
There are no files selected for viewing
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
179 changes: 179 additions & 0 deletions
179
stable/yugaware/templates/kube-state-metrics-clusterrole.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,179 @@ | ||
{{- if and .Values.kubeStateMetric.install (not .Values.kubeStateMetric.customEndpoint) -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
labels: | ||
app: {{ .Release.Name }}-yugaware-ksm | ||
chart: {{ template "yugaware.chart" . }} | ||
release: {{ .Release.Name }} | ||
name: {{ .Release.Name }}-ksm | ||
rules: | ||
{{ if has "certificatesigningrequests" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["certificates.k8s.io"] | ||
resources: | ||
- certificatesigningrequests | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "configmaps" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- configmaps | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "cronjobs" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["batch"] | ||
resources: | ||
- cronjobs | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "daemonsets" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["extensions", "apps"] | ||
resources: | ||
- daemonsets | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "deployments" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["extensions", "apps"] | ||
resources: | ||
- deployments | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "endpoints" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- endpoints | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "horizontalpodautoscalers" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["autoscaling"] | ||
resources: | ||
- horizontalpodautoscalers | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "ingresses" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["extensions", "networking.k8s.io"] | ||
resources: | ||
- ingresses | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "jobs" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["batch"] | ||
resources: | ||
- jobs | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "limitranges" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- limitranges | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "mutatingwebhookconfigurations" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["admissionregistration.k8s.io"] | ||
resources: | ||
- mutatingwebhookconfigurations | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "namespaces" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- namespaces | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "networkpolicies" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["networking.k8s.io"] | ||
resources: | ||
- networkpolicies | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "nodes" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- nodes | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "persistentvolumeclaims" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- persistentvolumeclaims | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "persistentvolumes" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- persistentvolumes | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "poddisruptionbudgets" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["policy"] | ||
resources: | ||
- poddisruptionbudgets | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "pods" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- pods | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "replicasets" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["extensions", "apps"] | ||
resources: | ||
- replicasets | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "replicationcontrollers" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- replicationcontrollers | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "resourcequotas" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- resourcequotas | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "secrets" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- secrets | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "services" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: [""] | ||
resources: | ||
- services | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "statefulsets" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["apps"] | ||
resources: | ||
- statefulsets | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "storageclasses" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: | ||
- storageclasses | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "validatingwebhookconfigurations" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["admissionregistration.k8s.io"] | ||
resources: | ||
- validatingwebhookconfigurations | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "volumeattachments" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: | ||
- volumeattachments | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{ if has "verticalpodautoscalers" $.Values.kubeStateMetric.collectors }} | ||
- apiGroups: ["autoscaling.k8s.io"] | ||
resources: | ||
- verticalpodautoscalers | ||
verbs: ["list", "watch"] | ||
{{ end -}} | ||
{{- end -}} |
18 changes: 18 additions & 0 deletions
18
stable/yugaware/templates/kube-state-metrics-clusterrolebinding.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,18 @@ | ||
{{- if and .Values.kubeStateMetric.install (not .Values.kubeStateMetric.customEndpoint) -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
labels: | ||
app: {{ .Release.Name }}-yugaware-ksm | ||
chart: {{ template "yugaware.chart" . }} | ||
release: {{ .Release.Name }} | ||
name: {{ .Release.Name }}-ksm | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ .Release.Name }}-ksm | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Release.Name }}-ksm | ||
namespace: {{ .Release.Namespace }} | ||
{{- end -}} |
66 changes: 66 additions & 0 deletions
66
stable/yugaware/templates/kube-state-metrics-deployment.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,66 @@ | ||
{{- if and .Values.kubeStateMetric.install (not .Values.kubeStateMetric.customEndpoint) -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Release.Name }}-ksm | ||
{{- if .Values.yugaware.service.annotations }} | ||
annotations: | ||
{{ toYaml .Values.yugaware.service.annotations | indent 4 }} | ||
{{- end }} | ||
labels: | ||
app: {{ .Release.Name }}-yugaware-ksm | ||
chart: {{ template "yugaware.chart" . }} | ||
release: {{ .Release.Name }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ .Release.Name }}-yugaware-ksm | ||
replicas: {{ .Values.kubeStateMetric.replicas }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Release.Name }}-yugaware-ksm | ||
annotations: | ||
{{- if .Values.yugaware.pod.annotations }} | ||
{{ toYaml .Values.yugaware.pod.annotations | indent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ .Release.Name }} | ||
{{- if .Values.kubeStateMetric.securityContext.enabled }} | ||
securityContext: | ||
fsGroup: {{ .Values.kubeStateMetric.securityContext.fsGroup }} | ||
runAsGroup: {{ .Values.kubeStateMetric.securityContext.runAsGroup }} | ||
runAsUser: {{ .Values.kubeStateMetric.securityContext.runAsUser }} | ||
{{- end }} | ||
containers: | ||
- name: kube-state-metrics-yugaware | ||
args: | ||
{{- if .Values.kubeStateMetric.extraArgs }} | ||
{{- range .Values.kubeStateMetric.extraArgs }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
- --port=8080 | ||
- --resources={{ .Values.kubeStateMetric.collectors | join "," }} | ||
imagePullPolicy: {{ .Values.kubeStateMetric.image.pullPolicy }} | ||
image: "{{ .Values.kubeStateMetric.image.repository }}:{{ .Values.kubeStateMetric.image.tag }}" | ||
ports: | ||
- containerPort: 8080 | ||
name: "http" | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 8080 | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: 8080 | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
{{- if .Values.kubeStateMetric.resources }} | ||
resources: | ||
{{ toYaml .Values.kubeStateMetric.resources | indent 10 }} | ||
{{- end }} | ||
{{- end -}} |
14 changes: 14 additions & 0 deletions
14
stable/yugaware/templates/kube-state-metrics-service-account.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,14 @@ | ||
{{- if and .Values.kubeStateMetric.install (not .Values.kubeStateMetric.customEndpoint) -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
labels: | ||
app: {{ .Release.Name }}-yugaware-ksm | ||
chart: {{ template "yugaware.chart" . }} | ||
release: {{ .Release.Name }} | ||
name: {{ .Release.Name }}-ksm | ||
{{- if .Values.yugaware.serviceAccountAnnotations }} | ||
annotations: | ||
{{ toYaml .Values.yugaware.serviceAccountAnnotations | indent 4 }} | ||
{{- end }} | ||
{{- end -}} |
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,23 @@ | ||
{{- if and .Values.kubeStateMetric.install (not .Values.kubeStateMetric.customEndpoint) -}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Release.Name }}-ksm | ||
labels: | ||
app: {{ .Release.Name }}-yugaware-ksm | ||
chart: {{ template "yugaware.chart" . }} | ||
release: {{ .Release.Name }} | ||
{{- if .Values.yugaware.service.annotations }} | ||
annotations: | ||
{{ toYaml .Values.yugaware.service.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
type: "ClusterIP" | ||
ports: | ||
- name: "http" | ||
protocol: TCP | ||
port: 8080 | ||
targetPort: 8080 | ||
selector: | ||
app: {{ .Release.Name }}-yugaware-ksm | ||
{{- end -}} |
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