Skip to content

Commit 8f9a108

Browse files
authored
Adding ClusterIP service in helm chart to expose controller metrics. (#73)
Description of changes: Adding ClusterIP service in helm chart to expose controller metrics. It is much simpler and easier to update prometheus scraping configuration with a static endpoint. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 735a36c commit 8f9a108

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

pkg/generate/ack/release.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var (
3333
"helm/templates/_helpers.tpl",
3434
"helm/templates/cluster-role-binding.yaml",
3535
"helm/templates/deployment.yaml",
36+
"helm/templates/service.yaml",
3637
"helm/templates/service-account.yaml",
3738
}
3839
releaseFuncMap = ttpl.FuncMap{

templates/helm/templates/service.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- if .Values.service.create }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ include "app.fullname" . }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
app.kubernetes.io/name: {{ include "app.name" . }}
9+
app.kubernetes.io/instance: {{ .Release.Name }}
10+
app.kubernetes.io/managed-by: Helm
11+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
12+
k8s-app: {{ include "app.name" . }}
13+
helm.sh/chart: {{ include "chart.name-version" . }}
14+
control-plane: controller
15+
spec:
16+
selector:
17+
app.kubernetes.io/name: {{ include "app.name" . }}
18+
app.kubernetes.io/instance: {{ .Release.Name }}
19+
app.kubernetes.io/managed-by: Helm
20+
k8s-app: {{ include "app.name" . }}
21+
{{- range $key, $value := .Values.deployment.labels }}
22+
{{ $key }}: {{ $value | quote }}
23+
{{- end }}
24+
type: {{ .Values.service.type }}
25+
ports:
26+
- name: metricsport
27+
port: 8080
28+
targetPort: 8080
29+
protocol: TCP
30+
{{- end }}

templates/helm/values.yaml.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ deployment:
1616
labels: {}
1717
containerPort: 8080
1818

19+
service:
20+
create: false
21+
type: "ClusterIP"
22+
1923
resources:
2024
requests:
2125
memory: "64Mi"

0 commit comments

Comments
 (0)