Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(helm): config file for api #4131

Merged
merged 2 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion contrib/helm/cds/templates/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ spec:
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
env:
- name: CDS_CONFIG_FILE
valueFrom:
secretKeyRef:
name: {{ template "cds.fullname" . }}
key: cds_config_file
- name: CDS_API_DATABASE_HOST
{{- if .Values.postgresql.enabled }}
value: {{ template "cds.postgresql.fullname" . }}
Expand Down Expand Up @@ -74,7 +79,7 @@ spec:
name: {{ template "cds.fullname" . }}
key: cds-api_secrets_key
command: ["/bin/sh"]
args: ["-c", "/app/cds-engine-linux-amd64 start api"]
args: ["-c", "echo $CDS_CONFIG_FILE | base64 --decode -o config.toml && /app/cds-engine-linux-amd64 start api --config config.toml"]
ports:
- name: http
containerPort: 8081
Expand Down
7 changes: 0 additions & 7 deletions contrib/helm/cds/templates/elasticsearch-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,3 @@ spec:
ports:
- name: http
containerPort: 8084
volumeMounts:
- name: cds-repos-data
mountPath: {{ .Values.repositories.persistence.mountPath }}
volumes:
- name: cds-repos-data
persistentVolumeClaim:
claimName: {{ (printf "%s-elasticsearch" (include "cds.fullname" .)) }}
8 changes: 4 additions & 4 deletions engine/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (a *API) CheckConfiguration(config interface{}) error {
}

if aConfig.Directories.Download == "" {
return fmt.Errorf("Invalid download directory")
return fmt.Errorf("Invalid download directory (empty)")
}

if ok, err := DirectoryExists(aConfig.Directories.Download); !ok {
Expand All @@ -309,7 +309,7 @@ func (a *API) CheckConfiguration(config interface{}) error {
}
log.Info("Directory %s has been created", aConfig.Directories.Download)
} else if err != nil {
return fmt.Errorf("Invalid download directory: %v", err)
return fmt.Errorf("Invalid download directory %s: %v", aConfig.Directories.Download, err)
}

if aConfig.Directories.Keys == "" {
Expand All @@ -333,15 +333,15 @@ func (a *API) CheckConfiguration(config interface{}) error {

if aConfig.Artifact.Mode == "local" {
if aConfig.Artifact.Local.BaseDirectory == "" {
return fmt.Errorf("Invalid artifact local base directory")
return fmt.Errorf("Invalid artifact local base directory (empty name)")
}
if ok, err := DirectoryExists(aConfig.Artifact.Local.BaseDirectory); !ok {
if err := os.MkdirAll(aConfig.Artifact.Local.BaseDirectory, os.FileMode(0700)); err != nil {
return fmt.Errorf("Unable to create directory %s: %v", aConfig.Artifact.Local.BaseDirectory, err)
}
log.Info("Directory %s has been created", aConfig.Artifact.Local.BaseDirectory)
} else if err != nil {
return fmt.Errorf("Invalid artifact local base directory: %v", err)
return fmt.Errorf("Invalid artifact local base directory %s: %v", aConfig.Artifact.Local.BaseDirectory, err)
}
}

Expand Down