-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(connector): add service and servicemonitor objects
* Add service and servicemonitor objects. * Add documentation for serviceMonitor on the connectors * Add connector serviceMonitor to ci common values Closes #85 --------- Co-authored-by: qoeveleie21 <qoeveleie21>
- Loading branch information
1 parent
a4065f9
commit 1e5d15b
Showing
5 changed files
with
90 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
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 }} |