-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1443 from smerle33/geoip
feat(geoipupdater): provide a cronjob for update geoip
- Loading branch information
Showing
5 changed files
with
80 additions
and
94 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
apiVersion: v1 | ||
description: MaxMind GeoIP database updater | ||
name: geoipupdates | ||
version: 0.1.0 | ||
version: 1.0.0 | ||
appVersion: "v7.1.0" | ||
maintainers: | ||
- email: [email protected] | ||
|
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,62 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ include "geoipupdate.fullname" . }} | ||
labels: | ||
{{ include "geoipupdate.labels" . | indent 4 }} | ||
spec: | ||
concurrencyPolicy: Forbid | ||
schedule: {{ .Values.geoipupdate.cron }} | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: {{ include "geoipupdate.fullname" . }} | ||
restartPolicy: Never | ||
containers: | ||
- name: geoipupdate | ||
image: "{{ .Values.image }}:{{ .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.imagePullPolicy }} | ||
{{- with .Values.containerSecurityContext }} | ||
securityContext: | ||
{{- toYaml . | nindent 16 }} | ||
{{- end }} | ||
volumeMounts: | ||
- name: geoipdata | ||
mountPath: /usr/share/GeoIP | ||
readOnly: false | ||
- name: tmpdir | ||
mountPath: /tmp | ||
readOnly: false | ||
resources: | ||
{{- toYaml .Values.resources | nindent 16 }} | ||
env: | ||
- name: GEOIPUPDATE_EDITION_IDS | ||
value: {{ .Values.geoipupdate.editions }} | ||
- name: GEOIPUPDATE_FREQUENCY | ||
value: {{ .Values.geoipupdate.update_frequency | quote }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ include "geoipupdate.fullname" . }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
volumes: | ||
- name: geoipdata | ||
{{- if .Values.dataVolume }} | ||
{{- toYaml .Values.dataVolume | nindent 14 }} | ||
{{- else }} | ||
emptyDir: {} | ||
{{- end }} | ||
- name: tmpdir | ||
emptyDir: | ||
medium: "Memory" |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,52 +1,49 @@ | ||
suite: default tests | ||
templates: | ||
- deployment.yaml | ||
- cronjob.yaml | ||
tests: | ||
- it: should define the default "mirrorbits" deployment with default imagePullPolicy and metadata labels | ||
template: deployment.yaml | ||
- it: should define the default "geoipupdate" cronjob with default imagePullPolicy and metadata labels | ||
template: cronjob.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Deployment | ||
of: CronJob | ||
- equal: | ||
path: spec.template.metadata.labels["app.kubernetes.io/name"] | ||
path: metadata.labels["app.kubernetes.io/name"] | ||
value: "geoipupdate" | ||
- equal: | ||
path: spec.template.metadata.labels["app.kubernetes.io/instance"] | ||
path: metadata.labels["app.kubernetes.io/instance"] | ||
value: "RELEASE-NAME" | ||
- equal: | ||
path: "spec.template.spec.containers[*].imagePullPolicy" | ||
path: "spec.jobTemplate.spec.template.spec.containers[*].imagePullPolicy" | ||
value: IfNotPresent | ||
- equal: | ||
path: spec.replicas | ||
value: 1 | ||
# GeoIP is an emptyDir, with default mountpath | ||
- equal: | ||
path: spec.template.spec.volumes[0].name | ||
path: spec.jobTemplate.spec.template.spec.volumes[0].name | ||
value: geoipdata | ||
- equal: | ||
path: spec.template.spec.volumes[0].emptyDir | ||
path: spec.jobTemplate.spec.template.spec.volumes[0].emptyDir | ||
value: {} | ||
- equal: | ||
path: spec.template.spec.containers[0].volumeMounts[0].name | ||
path: spec.jobTemplate.spec.template.spec.containers[0].volumeMounts[0].name | ||
value: geoipdata | ||
- equal: | ||
path: spec.template.spec.containers[0].volumeMounts[0].mountPath | ||
path: spec.jobTemplate.spec.template.spec.containers[0].volumeMounts[0].mountPath | ||
value: /usr/share/GeoIP | ||
- equal: | ||
path: spec.template.spec.containers[0].volumeMounts[0].readOnly | ||
path: spec.jobTemplate.spec.template.spec.containers[0].volumeMounts[0].readOnly | ||
value: false | ||
# Env. variables | ||
- equal: | ||
path: spec.template.spec.containers[0].env[0].name | ||
path: spec.jobTemplate.spec.template.spec.containers[0].env[0].name | ||
value: GEOIPUPDATE_EDITION_IDS | ||
- equal: | ||
path: spec.template.spec.containers[0].env[0].value | ||
path: spec.jobTemplate.spec.template.spec.containers[0].env[0].value | ||
value: GeoLite2-ASN GeoLite2-City GeoLite2-Country | ||
- equal: | ||
path: spec.template.spec.containers[0].env[1].name | ||
path: spec.jobTemplate.spec.template.spec.containers[0].env[1].name | ||
value: GEOIPUPDATE_FREQUENCY | ||
- equal: | ||
path: spec.template.spec.containers[0].env[1].value | ||
path: spec.jobTemplate.spec.template.spec.containers[0].env[1].value | ||
value: "24" |
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