Skip to content

Commit

Permalink
Merge pull request #1359 from facchettos/service-monitor
Browse files Browse the repository at this point in the history
feat: added service monitor to the chart
  • Loading branch information
FabianKramm authored Nov 17, 2023
2 parents 457a20a + 1eaaafa commit d157fff
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 0 deletions.
31 changes: 31 additions & 0 deletions charts/eks/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.monitoring.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: vcluster
release: "{{ .Release.Name }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: "{{ .Release.Service }}"
endpoints:
- interval: 30s
port: https
path: /metrics
scheme: https
tlsConfig:
ca:
secret:
name: vc-{{ .Release.Name }}
key: certificate-authority
cert:
secret:
name: vc-{{ .Release.Name }}
key: client-certificate
keySecret:
name: vc-{{ .Release.Name }}
key: client-key
{{- end }}
4 changes: 4 additions & 0 deletions charts/eks/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pro: false
# or statefulset is created.
headless: false

monitoring:
serviceMonitor:
enabled: false

# If the control plane is deployed in high availability mode
# Make sure to scale up the syncer.replicas, etcd.replicas, api.replicas & controller.replicas
enableHA: false
Expand Down
31 changes: 31 additions & 0 deletions charts/k0s/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.monitoring.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: vcluster
release: "{{ .Release.Name }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: "{{ .Release.Service }}"
endpoints:
- interval: 30s
port: https
path: /metrics
scheme: https
tlsConfig:
ca:
secret:
name: vc-{{ .Release.Name }}
key: certificate-authority
cert:
secret:
name: vc-{{ .Release.Name }}
key: client-certificate
keySecret:
name: vc-{{ .Release.Name }}
key: client-key
{{- end }}
4 changes: 4 additions & 0 deletions charts/k0s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pro: false
# or statefulset is created.
headless: false

monitoring:
serviceMonitor:
enabled: false

# Plugins that should get loaded. Usually you want to apply those via 'vcluster create ... -f https://.../plugin.yaml'
plugin: {}
# Manually configure a plugin called test
Expand Down
31 changes: 31 additions & 0 deletions charts/k3s/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.monitoring.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: vcluster
release: "{{ .Release.Name }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: "{{ .Release.Service }}"
endpoints:
- interval: 30s
port: https
path: /metrics
scheme: https
tlsConfig:
ca:
secret:
name: vc-{{ .Release.Name }}
key: certificate-authority
cert:
secret:
name: vc-{{ .Release.Name }}
key: client-certificate
keySecret:
name: vc-{{ .Release.Name }}
key: client-key
{{- end }}
4 changes: 4 additions & 0 deletions charts/k3s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ pro: false
# or statefulset is created.
headless: false

monitoring:
serviceMonitor:
enabled: false

# DefaultImageRegistry will be prepended to all deployed vcluster images, such as the vcluster pod, coredns etc.. Deployed
# images within the vcluster will not be rewritten.
defaultImageRegistry: ""
Expand Down
31 changes: 31 additions & 0 deletions charts/k8s/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.monitoring.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: vcluster
release: "{{ .Release.Name }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: "{{ .Release.Service }}"
endpoints:
- interval: 30s
port: https
path: /metrics
scheme: https
tlsConfig:
ca:
secret:
name: vc-{{ .Release.Name }}
key: certificate-authority
cert:
secret:
name: vc-{{ .Release.Name }}
key: client-certificate
keySecret:
name: vc-{{ .Release.Name }}
key: client-key
{{- end }}
4 changes: 4 additions & 0 deletions charts/k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pro: false
# or statefulset is created.
headless: false

monitoring:
serviceMonitor:
enabled: false

# If the control plane is deployed in high availability mode
# Make sure to scale up the syncer.replicas, etcd.replicas, api.replicas & controller.replicas
enableHA: false
Expand Down

0 comments on commit d157fff

Please sign in to comment.