Skip to content

Commit

Permalink
add pod monitor and more docu
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Getz committed Feb 5, 2024
1 parent 65e8f15 commit d6abddb
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ deployment:

ports:
http:
# port: # defaults to 80
# protocol: # defaults to TCP

health:
startupProbe:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
podMonitor:
enabled: true
# Default values, override them if necessary
#labels: {}
#annotations: {}
#port: "metrics"
#interval: "10s"
#path: "/metrics"
23 changes: 23 additions & 0 deletions blueprints/templates/infrastructure-charts/pod-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "myService.fullname" $ }}
{{- with .Values.podMonitor.labels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.podMonitor.annotations }}
annotations:
iits-consulting.chart-creator/version: CHART_CREATOR_VERSION
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "myService.selectorLabels" . | nindent 6 }}
podMetricsEndpoints:
- port: {{ default "metrics" .Values.podMonitor.port }}
interval: {{ default "10s" .Values.podMonitor.interval }}
path: {{ default "/metrics" .Values.podMonitor.path }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
matchLabels:
{{- include "myService.selectorLabels" . | nindent 6 }}
endpoints:
- port: {{ default "http" .Values.serviceMonitor.portName }}
- port: {{ default "metrics" .Values.serviceMonitor.port }}
interval: {{ default "10s" .Values.serviceMonitor.interval }}
path: {{ default "/metrics" .Values.serviceMonitor.path }}
{{- end }}
13 changes: 12 additions & 1 deletion blueprints/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ deployment:

ports:
http:
# port: # defaults to 80
# protocol: # defaults to TCP

health:
liveness:
Expand Down Expand Up @@ -105,6 +107,15 @@ serviceMonitor:
# Default values, override them if necessary
#labels: {}
#annotations: {}
#portName: "http"
#port: "metrics"
#interval: "10s"
#path: "/metrics"

podMonitor:
enabled: true
# Default values, override them if necessary
#labels: {}
#annotations: {}
#port: "metrics"
#interval: "10s"
#path: "/metrics"
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,25 @@ func createInfrastructureChartsCMD() *cobra.Command {
},
}

var podMonitorCreateHelpers = &cobra.Command{
Use: "pod-monitor",
Short: "Creates a pod-monitor deployment file",
Run: func(cmd *cobra.Command, args []string) {
checkAndCreateResource(cmd, DataInputForCreation{
ManifestName: "pod-monitor.yaml",
ChartType: "infrastructure-charts",
Version: version,
ReleaseName: overrideReleaseName,
})
},
}

cmdInfrastructureCharts.AddCommand(cmdCreateIngress)
cmdInfrastructureCharts.AddCommand(cmdCreateHelpers)
cmdInfrastructureCharts.AddCommand(saCreateHelpers)
cmdInfrastructureCharts.AddCommand(serviceCreateHelpers)
cmdInfrastructureCharts.AddCommand(deploymentCreateHelpers)
cmdInfrastructureCharts.AddCommand(serviceMonitorCreateHelpers)
cmdInfrastructureCharts.AddCommand(podMonitorCreateHelpers)
return cmdInfrastructureCharts
}

0 comments on commit d6abddb

Please sign in to comment.