Skip to content

Commit

Permalink
fix: blank config map support (#52)
Browse files Browse the repository at this point in the history
Signed-off-by: Gosha <[email protected]>
  • Loading branch information
gosharo authored Jun 22, 2023
1 parent 36e066f commit fc4a4b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ spec:
labels:
{{- include "piper.selectorLabels" . | nindent 8 }}
app: {{ .Chart.Name | trunc 63 | trimSuffix "-" }}
version: {{ .Values.image.tag | trunc 63 | trimSuffix "-" }}
version: {{ .Values.image.tag | default .Chart.AppVersion | trunc 63 | trimSuffix "-" }}
spec:
volumes:
{{- if .Values.piper.workflowsConfig }}
- name: piper-workflows-config
configMap:
name: piper-workflows-config
{{- end }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -40,9 +42,11 @@ spec:
containers:
- name: {{ .Chart.Name }}
volumeMounts:
{{- if .Values.piper.workflowsConfig }}
- mountPath: /piper-config
name: piper-workflows-config
readOnly: true
{{- end }}
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions pkg/conf/workflows_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package conf

import (
"encoding/json"
"log"

"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
"github.com/rookout/piper/pkg/utils"
Expand All @@ -21,6 +22,10 @@ func (wfc *WorkflowsConfig) WorkflowsSpecLoad(configPath string) error {
wfc.Configs = make(map[string]*ConfigInstance)

configs, err := utils.GetFilesData(configPath)
if len(configs) == 0 {
log.Printf("No config files to load at %s", configPath)
return nil
}
if err != nil {
return err
}
Expand Down

0 comments on commit fc4a4b2

Please sign in to comment.