Skip to content

Commit

Permalink
Merge pull request #844 from ywk253100/210126_jobservice_logger
Browse files Browse the repository at this point in the history
Support specify multiple job loggers for jobservice
  • Loading branch information
ywk253100 authored Jan 27, 2021
2 parents fc9226b + 4d73988 commit 6119981
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions templates/jobservice/jobservice-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data:
namespace: "harbor_job_service_namespace"
idle_timeout_second: 3600
job_loggers:
{{- if eq .Values.jobservice.jobLogger "file" }}
{{- if has "file" .Values.jobservice.jobLoggers }}
- name: "FILE"
level: {{ .Values.logLevel | upper }}
settings: # Customized settings of logger
Expand All @@ -31,12 +31,14 @@ data:
duration: 14 #days
settings: # Customized settings of sweeper
work_dir: "/var/log/jobs"
{{- else if eq .Values.jobservice.jobLogger "database" }}
{{- end }}
{{- if has "database" .Values.jobservice.jobLoggers }}
- name: "DB"
level: {{ .Values.logLevel | upper }}
sweeper:
duration: 14 #days
{{- else }}
{{- end }}
{{- if has "stdout" .Values.jobservice.jobLoggers }}
- name: "STD_OUTPUT"
level: {{ .Values.logLevel | upper }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion templates/jobservice/jobservice-dpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ spec:
configMap:
name: "{{ template "harbor.jobservice" . }}"
- name: job-logs
{{- if and .Values.persistence.enabled (eq .Values.jobservice.jobLogger "file") }}
{{- if and .Values.persistence.enabled (has "file" .Values.jobservice.jobLogger) }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.persistentVolumeClaim.jobservice.existingClaim | default (include "harbor.jobservice" .) }}
{{- else }}
Expand Down
2 changes: 1 addition & 1 deletion templates/jobservice/jobservice-pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $jobservice := .Values.persistence.persistentVolumeClaim.jobservice -}}
{{- if and .Values.persistence.enabled (not $jobservice.existingClaim) }}
{{- if eq .Values.jobservice.jobLogger "file" }}
{{- if has "file" .Values.jobservice.jobLoggers }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand Down
6 changes: 5 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,11 @@ jobservice:
serviceAccountName: ""
maxJobWorkers: 10
# The logger for jobs: "file", "database" or "stdout"
jobLogger: file
jobLoggers:
- file
# - database
# - stdout

# resources:
# requests:
# memory: 256Mi
Expand Down

0 comments on commit 6119981

Please sign in to comment.