Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-1780: Include maxmind account id #14

Merged
merged 12 commits into from
Apr 25, 2024
2 changes: 1 addition & 1 deletion charts/netobserv/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: netobserv
description: ElastiFlow NetObserv
type: application
version: 0.0.12
version: 0.0.13
appVersion: 6.4.3

keywords:
Expand Down
68 changes: 51 additions & 17 deletions charts/netobserv/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,32 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if or .Values.maxmind.asnEnabled .Values.maxmind.geoipEnabled }}
initContainers:
{{- if .Values.maxmind.asnEnabled }}
- name: download-geolite2-asn
image: curlimages/curl
command: ["sh", "-c"]
args:
- "curl -o /data/GeoLite2-ASN.tar.gz https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key={{ .Values.maxmind.licenseKey }}&suffix=tar.gz && tar -xzvf GeoLite2-ASN.tar.gz && rm GeoLite2-ASN.tar.gz"
volumeMounts:
- name: geolite2-data
mountPath: /data
{{- end }}
{{- if .Values.maxmind.geoipEnabled }}
- name: download-geolite2-city
image: curlimages/curl
command: ["sh", "-c"]
args:
- "curl -o /data/GeoLite2-City.tar.gz https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key={{ .Values.maxmind.licenseKey }}&suffix=tar.gz && tar -xzvf GeoLite2-City.tar.gz && rm GeoLite2-City.tar.gz"
- name: maxmind-geoipupdate
image: maxmindinc/geoipupdate
workingDir: /data
env:
- name: GEOIPUPDATE_ACCOUNT_ID
value: {{ .Values.maxmind.accountId | quote }}
- name: GEOIPUPDATE_LICENSE_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.maxmind.secretRef }}
key: license
- name: GEOIPUPDATE_EDITION_IDS
{{- if and .Values.maxmind.asnEnabled (not .Values.maxmind.geoipEnabled) }}
value: "GeoLite2-ASN"
{{- end }}
{{- if and .Values.maxmind.geoipEnabled (not .Values.maxmind.asnEnabled) }}
value: "GeoLite2-City"
{{- end }}
{{- if and .Values.maxmind.geoipEnabled .Values.maxmind.asnEnabled }}
value: "GeoLite2-ASN GeoLite2-City"
{{- end }}
- name: GEOIPUPDATE_DB_DIR
value: /data
volumeMounts:
- name: geolite2-data
mountPath: /data
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down Expand Up @@ -89,6 +95,34 @@ spec:
- name: geolite2-data
mountPath: /etc/elastiflow/maxmind
{{- end }}
{{- if or .Values.maxmind.asnEnabled .Values.maxmind.geoipEnabled }}
kgrubb marked this conversation as resolved.
Show resolved Hide resolved
- name: maxmind-geoipupdate
image: maxmindinc/geoipupdate
workingDir: /data
env:
- name: GEOIPUPDATE_ACCOUNT_ID
value: {{ .Values.maxmind.accountId | quote }}
- name: GEOIPUPDATE_LICENSE_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.maxmind.secretRef }}
key: license
- name: GEOIPUPDATE_EDITION_IDS
{{- if and .Values.maxmind.asnEnabled (not .Values.maxmind.geoipEnabled) }}
value: "GeoLite2-ASN"
{{- end }}
{{- if and .Values.maxmind.geoipEnabled (not .Values.maxmind.asnEnabled) }}
value: "GeoLite2-City"
{{- end }}
{{- if and .Values.maxmind.geoipEnabled .Values.maxmind.asnEnabled }}
value: "GeoLite2-ASN GeoLite2-City"
{{- end }}
- name: GEOIPUPDATE_DB_DIR
value: /data
volumeMounts:
- name: geolite2-data
mountPath: /data
{{- end }}
{{- if or .Values.maxmind.asnEnabled .Values.maxmind.geoipEnabled }}
volumes:
- name: geolite2-data
Expand Down
9 changes: 9 additions & 0 deletions charts/netobserv/templates/maxmind-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- if .Values.maxmind.createSecret -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.maxmind.secretRef }}
type: Opaque
data:
license: {{ .Values.maxmind.licenseKey | b64enc }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.license.secretRef | default "netobserv-license" }}
name: {{ .Values.license.secretRef }}
labels:
{{- include "netobserv.labels" . | nindent 4 }}
type: Opaque
Expand Down
26 changes: 16 additions & 10 deletions charts/netobserv/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,31 @@ env:
# EF_OUTPUT_GENERIC_HTTP_ADDRESSES: ''
# EF_OUTPUT_RISKIQ_ENABLE: 'false'

license:
# Specifies whether a secret should be created. If you don't have a license, no need to create a license secret.
createSecret: false
# Secret name to be used for the license. If empty, the secret name defaults to `netobserv-license`
# If no secret with a matching name exists, the value will be set from `licenseKey`.instead.
secretRef: "netobserv-license"
# Set license key, if not set, value from secret will be used
licenseKey: ""

# If the EF_PROCESSOR_ENRICH_IPADDR_MAXMIND_ASN_ENABLE or EF_PROCESSOR_ENRICH_IPADDR_MAXMIND_GEOIP_ENABLE
# environment variables are set to true, enable the corresponding service and provide a MaxMind license key:
# environment variables are set to true, enable the corresponding service and provide a MaxMind acount id and license key:
# https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
maxmind:
# Specifies whether a secret should be created for the maxmind license key.
createSecret: false
# Secret name to be used for the license. If empty, the secret name defaults to `maxmind-license`
# If no secret with a matching name exists, the value will be set from `licenseKey`.instead.
secretRef: "maxmind-license"
kgrubb marked this conversation as resolved.
Show resolved Hide resolved
# Enabling asn will look up the autonomous system number and autonomous system
# organization associated with IPv4 and IPv6 addresses.
asnEnabled: false
# Enabling geoip will look up the country, subdivisions (regions), city, and
# postal code associated with IPv4 and IPv6 addresses.
geoipEnabled: false
licenseKey: ""

license:
# Specifies whether a secret should be created. If you don't have a license, no need to create a license secret.
createSecret: false
# Secret name to be used for the license. If empty, the secret name defaults to `netobserv-license`
# If no secret with a matching name exists, the value will be set from `licenseKey`.instead.
secretRef: ""
# Set license key, if not set, value from secret will be used
accountId: ""
licenseKey: ""

imagePullSecrets: []
Expand Down