Skip to content

Commit

Permalink
Merge pull request #54 from Iceber/add_clustersynchro_metrics
Browse files Browse the repository at this point in the history
clusterpedia: add clustersynchro manager metrics service
  • Loading branch information
Iceber authored Jul 17, 2023
2 parents 3e10df3 + 098f8d5 commit 7d02ad1
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/clusterpedia/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.7.3
version: 1.8.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
7 changes: 7 additions & 0 deletions charts/clusterpedia/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- printf "%s-%s" (include "common.names.fullname" .) "controller-manager" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "clusterpedia.kubeStateMetrics.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "kube-state-metrics" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Return the proper apiserver image name
Expand Down
18 changes: 18 additions & 0 deletions charts/clusterpedia/templates/clusterpedia-kube-state-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.clustersynchroManager.kubeStateMetrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "clusterpedia.kubeStateMetrics.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
spec:
ports:
- name: kube-state-metrics
port: 8080
targetPort: 8080
selector:
app: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
{{- if .Values.clustersynchroManager.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.clustersynchroManager.podLabels "context" $) | nindent 4 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ spec:
- --leader-elect-retry-period={{ .Values.clustersynchroManager.leaderElect.retryPeriod }}
- --leader-elect-resource-lock={{ .Values.clustersynchroManager.leaderElect.resourceLock }}
- --worker-number={{ .Values.clustersynchroManager.workerNumber }}
{{- if .Values.clustersynchroManager.kubeStateMetrics.enabled }}
- --enable-kube-state-metrics
{{- end }}
{{- with (include "clusterpedia.clustersynchroManager.featureGates" .) }}
- {{ . }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "clusterpedia.clustersynchroManager.fullname" . }}-metrics
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
spec:
ports:
- name: metrics
port: 8081
targetPort: 8081
selector:
app: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
{{- if .Values.clustersynchroManager.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.clustersynchroManager.podLabels "context" $) | nindent 4 }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/clusterpedia/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ clustersynchroManager:
renewDeadline: "10s"
retryPeriod: "2s"
resourceLock: "leases"
kubeStateMetrics:
enabled: false

## controller manager config
controllerManager:
Expand Down

0 comments on commit 7d02ad1

Please sign in to comment.