You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
6.5 KiB
150 lines
6.5 KiB
{{- if .Values.audiencias.cron.enabled }}
|
|
{{- $edemoUrl := .Values.edemocracia.hostname -}}
|
|
apiVersion: batch/v1beta1
|
|
kind: CronJob
|
|
metadata:
|
|
name: {{ include "edemocracia.fullname" . }}-audienciascron
|
|
labels:
|
|
{{- include "edemocracia.labels" . | nindent 4 }}
|
|
spec:
|
|
schedule: {{ .Values.audiencias.cron.schedule | quote }}
|
|
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/bash", "-c" ]
|
|
args:
|
|
- >-
|
|
TIME=$[RANDOM%120];
|
|
echo Sleeping $TIME seconds...;
|
|
sleep $TIME;
|
|
echo Running prune_rooms... && python3 /var/labhacker/audiencias/manage.py prune_rooms;
|
|
echo Running prune_presences... && python3 /var/labhacker/audiencias/manage.py prune_presences;
|
|
if [[ ! -z "$WEBSERVICE_URL" ]]; then
|
|
echo Running get_camara_webservice... &&
|
|
python3 /var/labhacker/audiencias/manage.py get_camara_webservice;
|
|
fi;
|
|
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.cron.resources | nindent 16 }}
|
|
volumeMounts:
|
|
- mountPath: /var/labhacker/audiencias/public/
|
|
name: {{ include "edemocracia.fullname" . }}-audiencias
|
|
restartPolicy: Never
|
|
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 }}
|