-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add service and servicemonitor objects. Add port to connector to depl…
…oyment
- Loading branch information
qoeveleie21
committed
Nov 13, 2024
1 parent
a4065f9
commit f39e186
Showing
3 changed files
with
66 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{{- $connectorsGlobal := .Values.connectorsGlobal }} | ||
{{- $serviceType := .Values.service.type }} | ||
|
||
{{- range .Values.connectors }} | ||
{{- $connectorName := .name }} | ||
{{- if and .enabled .env.CONNECTOR_EXPOSE_METRICS }} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ $connectorName }}-service-{{ include "opencti.fullname" $ }} | ||
labels: | ||
opencti.connector: {{ $connectorName }} | ||
{{- include "opencti.labels" $ | nindent 4 }} | ||
spec: | ||
type: {{ $serviceType }} | ||
ports: | ||
{{- if .env.CONNECTOR_EXPOSE_METRICS }} | ||
- name: metrics | ||
port: {{ .env.CONNECTOR_METRICS_PORT | default 9095 }} | ||
targetPort: {{ .env.CONNECTOR_METRICS_PORT | default 9095 }} | ||
protocol: TCP | ||
{{- end }} | ||
selector: | ||
opencti.connector: {{ $connectorName }} | ||
{{- include "opencti.selectorLabels" $ | nindent 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,32 @@ | ||
{{- $connectorsGlobal := .Values.connectorsGlobal }} | ||
{{- range .Values.connectors }} | ||
{{- $connectorName := .name }} | ||
|
||
{{- if and ((.serviceMonitor).enabled) .env.CONNECTOR_EXPOSE_METRICS }} | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ $connectorName }} | ||
labels: | ||
opencti.connector: {{ $connectorName }} | ||
{{- include "opencti.labels" $ | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
opencti.connector: {{ $connectorName }} | ||
{{- include "opencti.selectorLabels" $ | nindent 6 }} | ||
endpoints: | ||
- port: metrics | ||
interval: {{ default "30s" .serviceMonitor.interval | quote }} | ||
scrapeTimeout: {{ default "10s" .serviceMonitor.scrapeTimeout | quote }} | ||
{{- if .serviceMonitor.metricRelabelings }} | ||
metricRelabelings: | ||
{{- toYaml .serviceMonitor.metricRelabelings | nindent 4 }} | ||
{{- end }} | ||
{{- if .serviceMonitor.relabelings }} | ||
relabelings: | ||
{{- toYaml .serviceMonitor.relabelings | nindent 4 }} | ||
{{- end }} | ||
{{- end -}} | ||
{{- end }} |