Skip to content

Commit

Permalink
fix(harbor-core) Modify harbor core config file path management + gom…
Browse files Browse the repository at this point in the history
…plate issues

Signed-off-by: Jeremie Monsinjon <jeremie.monsinjon@corp.ovh.com>
  • Loading branch information
Jeremie Monsinjon committed Jan 31, 2020
1 parent b40e7ee commit 426be17
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions assets/templates/chartmuseum/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- /* https://github.com/helm/chartmuseum#configuration */ }}
{{- /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/chartserver/env.jinja */ }}
{{- /* https://github.com/helm/chartmuseum#configuration */ -}}
{{- /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/chartserver/env.jinja */ -}}
allow.overwrite: true

auth.anonymous.get: false
Expand Down
4 changes: 2 additions & 2 deletions assets/templates/clair/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ /* https://github.com/coreos/clair/blob/master/config.yaml.sample */ }}
{{ /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/clair/config.yaml.jinja */ }}
{{ /* https://github.com/coreos/clair/blob/master/config.yaml.sample */ -}}
{{ /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/clair/config.yaml.jinja */ -}}
clair:
database:
type: pgsql
Expand Down
2 changes: 1 addition & 1 deletion assets/templates/core/app.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- /* https://github.com/goharbor/harbor/blob/master/docs/1.10/install-config/configure-yml-file.md */ }}
{{- /* https://github.com/goharbor/harbor/blob/master/docs/1.10/install-config/configure-yml-file.md */ -}}
appname = Harbor
runmode = prod
enablegzip = true
Expand Down
2 changes: 1 addition & 1 deletion assets/templates/jobservice/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/jobservice/config.yml.jinja */ }}
{{- /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/jobservice/config.yml.jinja */ -}}
protocol: "http"
port: {{ env.Getenv "PORT" }}

Expand Down
18 changes: 9 additions & 9 deletions assets/templates/registry/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ notifications:
threshold: 5
backoff: 1s
ignoredmediatypes:
- application/vnd.docker.image.rootfs.diff.tar.gzip
- application/vnd.docker.image.rootfs.foreign.diff.tar.gzip
- application/vnd.oci.image.layer.v1.tar
- application/vnd.oci.image.layer.v1.tar+gzip
- application/vnd.oci.image.layer.v1.tar+zstd
- application/vnd.oci.image.layer.nondistributable.v1.tar
- application/vnd.oci.image.layer.nondistributable.v1.tar+gzip
- application/vnd.oci.image.layer.nondistributable.v1.tar+zstd
- application/octet-stream
- application/vnd.docker.image.rootfs.diff.tar.gzip
- application/vnd.docker.image.rootfs.foreign.diff.tar.gzip
- application/vnd.oci.image.layer.v1.tar
- application/vnd.oci.image.layer.v1.tar+gzip
- application/vnd.oci.image.layer.v1.tar+zstd
- application/vnd.oci.image.layer.nondistributable.v1.tar
- application/vnd.oci.image.layer.nondistributable.v1.tar+gzip
- application/vnd.oci.image.layer.nondistributable.v1.tar+zstd
- application/octet-stream
auth:
token:
issuer: harbor-token-issuer
Expand Down
3 changes: 2 additions & 1 deletion controllers/harbor/components/harbor-core/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/sha256"
"fmt"
"io/ioutil"
"path"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -65,7 +66,7 @@ func (c *HarborCore) GetConfigMaps(ctx context.Context) []*corev1.ConfigMap { //

// https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/core/env.jinja
Data: map[string]string{
"CONFIG_PATH": coreConfigPath,
"CONFIG_PATH": path.Join(coreConfigPath, configFileName),

"AUTH_MODE": "db_auth",
"CFG_EXPIRATION": "5",
Expand Down
13 changes: 7 additions & 6 deletions controllers/harbor/components/harbor-core/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ var (

const (
initImage = "hairyhenderson/gomplate"
coreConfigPath = "/etc/core/"
coreConfigPath = "/etc/core"
keyFileName = "key"
configFileName = "app.conf"
port = 8080 // https://github.com/goharbor/harbor/blob/2fb1cc89d9ef9313842cc68b4b7c36be73681505/src/common/const.go#L127

healthCheckPeriod = 90 * time.Second
Expand Down Expand Up @@ -346,22 +347,22 @@ func (c *HarborCore) GetDeployments(ctx context.Context) []*appsv1.Deployment {
{
Name: "config",
ReadOnly: true,
MountPath: coreConfigPath,
SubPath: "app.conf",
MountPath: path.Join(coreConfigPath, configFileName),
SubPath: configFileName,
}, {
Name: "secret-key",
ReadOnly: true,
MountPath: "/etc/core/" + keyFileName,
MountPath: path.Join(coreConfigPath, keyFileName),
SubPath: keyFileName,
}, {
Name: "certificate",
ReadOnly: true,
MountPath: "/etc/core/private_key.pem",
MountPath: path.Join(coreConfigPath, "private_key.pem"),
SubPath: "tls.key",
}, {
Name: "psc",
ReadOnly: false,
MountPath: "/etc/core/token",
MountPath: path.Join(coreConfigPath, "token"),
},
},
},
Expand Down

0 comments on commit 426be17

Please sign in to comment.