diff --git a/charts/edemocracia/v0.4.0/templates/audienciasweb-cron.yaml b/charts/edemocracia/v0.4.0/templates/audienciasweb-cron.yaml new file mode 100644 index 0000000..68aeb3f --- /dev/null +++ b/charts/edemocracia/v0.4.0/templates/audienciasweb-cron.yaml @@ -0,0 +1,145 @@ +{{- if .Values.audiencias.enabled }} +{{- $edemoUrl := .Values.edemocracia.hostname -}} +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: {{ include "edemocracia.fullname" . }}-audienciasweb-cron + labels: + {{- include "edemocracia.labels" . | nindent 4 }} +spec: + schedule: "*/10 * * * *" + concurrencyPolicy: Forbid + jobTemplate: + spec: + template: + metadata: + labels: + {{- include "edemocracia.labels" . | nindent 12 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ include "edemocracia.fullname" . }}-audienciasweb + image: "{{ .Values.audiencias.image.repository }}:{{ .Values.audiencias.image.tag }}" + imagePullPolicy: {{ .Values.audiencias.image.pullPolicy }} + command: [ "/bin/sh", "-c" ] + args: + - >- + sleep $[RANDOM\%120] && + python3 /var/labhacker/audiencias/manage.py get_camara_webservice + python3 /var/labhacker/audiencias/manage.py prune_rooms + python3 /var/labhacker/audiencias/manage.py prune_presences + env: + - name: ADMIN_EMAIL + value: {{ .Values.edemocracia.admin.email | quote }} + - name: ADMIN_PASSWORD + value: {{ .Values.edemocracia.admin.password | quote }} + - name: ADMIN_USERNAME + value: admin + - name: ALLOWED_HOSTS + value: audienciasweb, localhost, 127.0.0.1, "{{ $edemoUrl }}" + - name: COMPRESS_OFFLINE + value: "True" + - name: DATABASE_ENGINE + value: postgresql_psycopg2 + - name: DATABASE_HOST + value: {{ (include "postgresql.fullname" .) }} + - name: DATABASE_NAME + value: audiencias + - name: DATABASE_PASSWORD + value: {{ .Values.postgresql.postgresqlPassword | quote }} + - name: DATABASE_PORT + value: "5432" + - name: DATABASE_USER + value: {{ .Values.postgresql.postgresqlUsername | quote }} + - name: DEBUG + value: "False" + - name: DEFAULT_FROM_EMAIL + value: '"Portal e-Democracia[audiencias]" <{{ .Values.edemocracia.admin.email }}>' + - name: DJANGO_SECRET_KEY + value: {{ .Values.edemocracia.apikey | quote }} + - name: EMAIL_HOST + value: {{ .Values.smtp.host | quote }} + - name: EMAIL_HOST_PASSWORD + value: {{ .Values.smtp.password | quote }} + - name: EMAIL_HOST_USER + value: {{ .Values.smtp.username | quote }} + - name: EMAIL_PORT + value: {{ .Values.smtp.port | quote }} + - name: EMAIL_USE_TLS + value: {{ .Values.smtp.tls | quote}} + - name: ENABLE_REMOTE_USER + value: "True" + - name: FORCE_SCRIPT_NAME + value: /audiencias + - name: GOOGLE_ANALYTICS_ID + value: {{ .Values.edemocracia.googleAnalyticsId | quote }} + - name: LOGIN_REDIRECT_URL + value: / + - name: LOGIN_URL + value: / + - name: LOGOUT_REDIRECT_URL + value: / + - name: NOTIFICATION_EMAIL_LIST + value: "{{ .Values.edemocracia.admin.email }},{{ .Values.audiencias.notifEmailList }}" + - name: OLARK_ID + value: {{ .Values.edemocracia.olarkId | quote }} + - name: RECAPTCHA_PRIVATE_KEY + value: {{ .Values.edemocracia.recaptcha.privateKey | quote }} + - name: RECAPTCHA_SITE_KEY + value: {{ .Values.edemocracia.recaptcha.siteKey | quote }} + - name: REDIS_SERVER + value: {{ (include "redis.fullname" .) }}-master + - name: SESSION_COOKIE_NAME + value: audiencias_session + - name: SITE_DOMAIN + value: "{{ $edemoUrl }}" + - name: SITE_NAME + value: {{ .Values.edemocracia.siteName | quote }} + - name: STATIC_URL + value: /audiencias/static/ + - name: URL_PREFIX + value: audiencias + - name: WEBSERVICE_URL + value: {{ .Values.audiencias.webservice.url | quote }} + - name: WORDS_BLACK_LIST + value: {{ .Values.audiencias.wordsBlacklist | quote }} + resources: + {{- toYaml .Values.audiencias.resources | nindent 16 }} + volumeMounts: + - mountPath: /var/labhacker/audiencias/public/ + name: {{ include "edemocracia.fullname" . }}-audiencias + restartPolicy: Always + volumes: + - name: {{ include "edemocracia.fullname" . }}-audiencias + persistentVolumeClaim: + claimName: {{ include "edemocracia.fullname" . }}-audiencias + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - {{ include "edemocracia.name" . }} + - key: app.kubernetes.io/instance + operator: In + values: + - {{ .Release.Name }} + - key: app.kubernetes.io/component + operator: In + values: + - audiencias + topologyKey: kubernetes.io/hostname + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} \ No newline at end of file