Merge pull request #5893 from ninjadq/change_ui_2_core

Rename harbor-ui to harbor-core
This commit is contained in:
Qian Deng 2018-09-19 16:53:48 +08:00 committed by GitHub
commit 3e76eaf1b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
202 changed files with 408 additions and 489 deletions

13
.gitignore vendored
View File

@ -4,26 +4,17 @@ harbor
make/docker-compose.yml
make/common/config/*
make/dev/adminserver/harbor_adminserver
make/dev/ui/harbor_ui
make/dev/core/harbor_core
make/dev/jobservice/harbor_jobservice
make/photon/*/binary/
src/adminserver/adminserver
src/ui/ui
src/core/core
src/jobservice/jobservice
src/common/dao/dao.test
*.pyc
jobservice/test
src/ui/static/*.html
src/ui/static/*.bundle.js
src/ui/static/*.bundle.js.map
src/ui/static/harbor-logo.*.png
src/ui/static/*.min.*
src/ui/static/styles.css
src/ui/static/i18n
src/ui/static/shapes
src/portal/coverage/
src/portal/dist/
src/portal/html-report/

View File

@ -22,7 +22,7 @@ env:
DOCKER_COMPOSE_VERSION: 1.7.1
HARBOR_ADMIN: admin
HARBOR_ADMIN_PASSWD: Harbor12345
UI_SECRET: tempString
CORE_SECRET: tempString
KEY_PATH: /data/secretkey
REDIS_HOST: localhost
REG_VERSION: v2.6.2
@ -44,7 +44,7 @@ before_install:
- sudo ./tests/generateCerts.sh
- sudo ./make/prepare
- sudo mkdir -p "/data/redis"
- sudo mkdir -p /etc/ui/ca/ && sudo mv ./tests/ca.crt /etc/ui/ca/
- sudo mkdir -p /etc/core/ca/ && sudo mv ./tests/ca.crt /etc/core/ca/
- sudo mkdir -p /harbor && sudo mv ./VERSION /harbor/UIVERSION
- sudo ./tests/testprepare.sh
@ -90,6 +90,6 @@ script:
- sudo docker-compose -f ./make/docker-compose.test.yml up -d
- make go_check
- ./tests/pushimage.sh
- go test -race -i ./src/ui ./src/adminserver ./src/jobservice
- go test -race -i ./src/core ./src/adminserver ./src/jobservice
- sudo -E env "PATH=$PATH" "POSTGRES_MIGRATION_SCRIPTS_PATH=/home/travis/gopath/src/github.com/goharbor/harbor/make/migrations/postgresql/" ./tests/coverage4gotest.sh
- goveralls -coverprofile=profile.cov -service=travis-ci

View File

@ -10,7 +10,7 @@
# compile from golang image
# for example: make compile_golangimage -e GOBUILDIMAGE= \
# golang:1.7.3
# compile_adminserver, compile_ui, compile_jobservice: compile specific binary
# compile_adminserver, compile_core, compile_jobservice: compile specific binary
#
# build: build Harbor docker images from photon baseimage
#
@ -67,8 +67,8 @@ MAKEPATH=$(BUILDPATH)/make
MAKEDEVPATH=$(MAKEPATH)/dev
SRCPATH=./src
TOOLSPATH=$(BUILDPATH)/tools
UIPATH=$(BUILDPATH)/src/ui
UINGPATH=$(BUILDPATH)/src/portal
CORE_PATH=$(BUILDPATH)/src/core
PORTAL_PATH=$(BUILDPATH)/src/portal
GOBASEPATH=/go/src/github.com/goharbor
CHECKENVCMD=checkenv.sh
@ -129,20 +129,20 @@ GOBUILDPATH=$(GOBASEPATH)/harbor
GOIMAGEBUILDCMD=/usr/local/go/bin/go
GOIMAGEBUILD=$(GOIMAGEBUILDCMD) build
GOBUILDPATH_ADMINSERVER=$(GOBUILDPATH)/src/adminserver
GOBUILDPATH_UI=$(GOBUILDPATH)/src/ui
GOBUILDPATH_CORE=$(GOBUILDPATH)/src/core
GOBUILDPATH_JOBSERVICE=$(GOBUILDPATH)/src/jobservice
GOBUILDPATH_REGISTRYCTL=$(GOBUILDPATH)/src/registryctl
GOBUILDMAKEPATH=$(GOBUILDPATH)/make
GOBUILDMAKEPATH_ADMINSERVER=$(GOBUILDMAKEPATH)/photon/adminserver
GOBUILDMAKEPATH_UI=$(GOBUILDMAKEPATH)/photon/ui
GOBUILDMAKEPATH_CORE=$(GOBUILDMAKEPATH)/photon/core
GOBUILDMAKEPATH_JOBSERVICE=$(GOBUILDMAKEPATH)/photon/jobservice
GOBUILDMAKEPATH_REGISTRYCTL=$(GOBUILDMAKEPATH)/photon/registryctl
# binary
ADMINSERVERBINARYPATH=$(MAKEDEVPATH)/adminserver
ADMINSERVERBINARYNAME=harbor_adminserver
UIBINARYPATH=$(MAKEDEVPATH)/ui
UIBINARYNAME=harbor_ui
CORE_BINARYPATH=$(MAKEDEVPATH)/core
CORE_BINARYNAME=harbor_core
JOBSERVICEBINARYPATH=$(MAKEDEVPATH)/jobservice
JOBSERVICEBINARYNAME=harbor_jobservice
REGISTRYCTLBINARYPATH=$(MAKEDEVPATH)/registryctl
@ -176,7 +176,7 @@ DOCKERFILEPATH_COMMON=$(MAKEPATH)/common
# docker image name
DOCKERIMAGENAME_ADMINSERVER=goharbor/harbor-adminserver
DOCKERIMAGENAME_PORTAL=goharbor/harbor-portal
DOCKERIMAGENAME_UI=goharbor/harbor-ui
DOCKERIMAGENAME_CORE=goharbor/harbor-core
DOCKERIMAGENAME_JOBSERVICE=goharbor/harbor-jobservice
DOCKERIMAGENAME_LOG=goharbor/harbor-log
DOCKERIMAGENAME_DB=goharbor/harbor-db
@ -211,7 +211,7 @@ REGISTRYPASSWORD=default
# cmds
DOCKERSAVE_PARA=$(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \
$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) \
$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
$(DOCKERIMAGENAME_CORE):$(VERSIONTAG) \
$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
@ -271,11 +271,11 @@ compile_adminserver:
$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_ADMINSERVER) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -o $(GOBUILDMAKEPATH_ADMINSERVER)/$(ADMINSERVERBINARYNAME)
@echo "Done."
compile_ui:
@echo "compiling binary for ui (golang image)..."
compile_core:
@echo "compiling binary for core (golang image)..."
@echo $(GOBASEPATH)
@echo $(GOBUILDPATH)
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_UI) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -o $(GOBUILDMAKEPATH_UI)/$(UIBINARYNAME)
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_CORE) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -o $(GOBUILDMAKEPATH_CORE)/$(CORE_BINARYNAME)
@echo "Done."
compile_jobservice:
@ -288,7 +288,7 @@ compile_registryctl:
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_REGISTRYCTL) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -o $(GOBUILDMAKEPATH_REGISTRYCTL)/$(REGISTRYCTLBINARYNAME)
@echo "Done."
compile:check_environment compile_adminserver compile_ui compile_jobservice compile_registryctl
compile:check_environment compile_adminserver compile_core compile_jobservice compile_registryctl
prepare:
@echo "preparing..."
@ -331,7 +331,7 @@ modify_sourcefiles:
@chmod 600 $(MAKEPATH)/common/templates/notary/notary-signer.key
@chmod 600 $(MAKEPATH)/common/templates/notary/notary-signer.crt
@chmod 600 $(MAKEPATH)/common/templates/notary/notary-signer-ca.crt
@chmod 600 $(MAKEPATH)/common/templates/ui/private_key.pem
@chmod 600 $(MAKEPATH)/common/templates/core/private_key.pem
@chmod 600 $(MAKEPATH)/common/templates/registry/root.crt
install: compile version build modify_sourcefiles prepare modify_composefile start
@ -411,10 +411,10 @@ pushimage:
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
@$(DOCKERTAG) $(DOCKERIMAGENAME_UI):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG)
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
@$(DOCKERTAG) $(DOCKERIMAGENAME_CORE):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_CORE):$(VERSIONTAG)
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_CORE):$(VERSIONTAG) \
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG)
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_CORE):$(VERSIONTAG)
@$(DOCKERTAG) $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) \
@ -459,13 +459,13 @@ swagger_client:
cleanbinary:
@echo "cleaning binary..."
@if [ -f $(ADMINSERVERBINARYPATH)/$(ADMINSERVERBINARYNAME) ] ; then rm $(ADMINSERVERBINARYPATH)/$(ADMINSERVERBINARYNAME) ; fi
@if [ -f $(UIBINARYPATH)/$(UIBINARYNAME) ] ; then rm $(UIBINARYPATH)/$(UIBINARYNAME) ; fi
@if [ -f $(CORE_BINARYPATH)/$(CORE_BINARYNAME) ] ; then rm $(CORE_BINARYPATH)/$(CORE_BINARYNAME) ; fi
@if [ -f $(JOBSERVICEBINARYPATH)/$(JOBSERVICEBINARYNAME) ] ; then rm $(JOBSERVICEBINARYPATH)/$(JOBSERVICEBINARYNAME) ; fi
cleanimage:
@echo "cleaning image for photon..."
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_UI):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_CORE):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_DB):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
@ -492,7 +492,7 @@ cleanall: cleanbinary cleanimage cleandockercomposefile cleanversiontag cleanpac
clean:
@echo " make cleanall: remove binary, Harbor images, specific version docker-compose"
@echo " file, specific version tag, online and offline install package"
@echo " make cleanbinary: remove ui and jobservice binary"
@echo " make cleanbinary: remove core and jobservice binary"
@echo " make cleanimage: remove Harbor images"
@echo " make cleandockercomposefile: remove specific version docker-compose"
@echo " make cleanversiontag: cleanpackageremove specific version tag"

View File

@ -46,10 +46,10 @@ From time to time, you may need to mannually test Harbor REST API. You can deplo
ui:
...
volumes:
- ./common/config/ui/app.conf:/etc/ui/app.conf:z
- ./common/config/ui/private_key.pem:/etc/ui/private_key.pem:z
- /data/secretkey:/etc/ui/key:z
- /data/ca_download/:/etc/ui/ca/:z
- ./common/config/ui/app.conf:/etc/core/app.conf:z
- ./common/config/ui/private_key.pem:/etc/core/private_key.pem:z
- /data/secretkey:/etc/core/key:z
- /data/ca_download/:/etc/core/ca/:z
## add two lines as below ##
- ../src/ui/static/vendors/swagger-ui-2.1.4/dist:/harbor/static/vendors/swagger
- ../src/ui/static/resources/yaml/swagger.yaml:/harbor/static/resources/yaml/swagger.yaml

View File

@ -198,7 +198,7 @@ Stopping Harbor:
$ sudo docker-compose stop
Stopping nginx ... done
Stopping harbor-jobservice ... done
Stopping harbor-ui ... done
Stopping harbor-core ... done
Stopping harbor-db ... done
Stopping registry ... done
Stopping harbor-log ... done
@ -375,11 +375,11 @@ By default, Harbor limits the CPU usage of Clair container to 150000 and avoids
harbor-db docker-entrypoint.sh mysqld Up 3306/tcp
harbor-jobservice /harbor/harbor_jobservice Up
harbor-log /bin/sh -c crond && rsyslo ... Up 127.0.0.1:1514->514/tcp
harbor-ui /harbor/harbor_ui Up
harbor-core /harbor/harbor_core Up
nginx nginx -g daemon off; Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
registry /entrypoint.sh serve /etc/ ... Up 5000/tcp
```
If a container is not in **UP** state, check the log file of that container in directory ```/var/log/harbor```. For example, if the container ```harbor-ui``` is not running, you should look at the log file ```ui.log```.
If a container is not in **UP** state, check the log file of that container in directory ```/var/log/harbor```. For example, if the container ```harbor-core``` is not running, you should look at the log file ```ui.log```.
2.When setting up Harbor behind an nginx proxy or elastic load balancing, look for the line below, in `common/templates/nginx/nginx.http.conf` and remove it from the sections if the proxy already has similar settings: `location /`, `location /v2/` and `location /service/`.

View File

@ -36,7 +36,7 @@ EMAIL_INSECURE=$email_insecure
HARBOR_ADMIN_PASSWORD=$harbor_admin_password
PROJECT_CREATION_RESTRICTION=$project_creation_restriction
MAX_JOB_WORKERS=$max_job_workers
UI_SECRET=$ui_secret
CORE_SECRET=$core_secret
JOBSERVICE_SECRET=$jobservice_secret
TOKEN_EXPIRATION=$token_expiration
CFG_EXPIRATION=5
@ -55,7 +55,7 @@ UAA_ENDPOINT=$uaa_endpoint
UAA_CLIENTID=$uaa_clientid
UAA_CLIENTSECRET=$uaa_clientsecret
UAA_VERIFY_CERT=$uaa_verify_cert
UI_URL=$ui_url
CORE_URL=$core_url
JOBSERVICE_URL=$jobservice_url
CLAIR_URL=$clair_url
NOTARY_URL=$notary_url

View File

@ -9,7 +9,7 @@ CACHE_REDIS_DB=$cache_redis_db_index
# Credential for internal communication
BASIC_AUTH_USER=chart_controller
BASIC_AUTH_PASS=$ui_secret
BASIC_AUTH_PASS=$core_secret
# Multiple tenants
# Must be set with 1 to support project namespace

View File

@ -22,4 +22,4 @@ clair:
attempts: 3
renotifyinterval: 2h
http:
endpoint: http://ui:8080/service/notifications/clair
endpoint: http://core:8080/service/notifications/clair

View File

@ -1,10 +1,10 @@
LOG_LEVEL=info
CONFIG_PATH=/etc/ui/app.conf
UI_SECRET=$ui_secret
CONFIG_PATH=/etc/core/app.conf
CORE_SECRET=$core_secret
JOBSERVICE_SECRET=$jobservice_secret
GODEBUG=netdns=cgo
ADMINSERVER_URL=$adminserver_url
UAA_CA_ROOT=/etc/ui/certificates/uaa_ca.pem
UAA_CA_ROOT=/etc/core/certificates/uaa_ca.pem
_REDIS_URL=$redis_host:$redis_port,100,$redis_password
SYNC_REGISTRY=false
CHART_CACHE_DRIVER=$chart_cache_driver

View File

@ -1,4 +1,4 @@
UI_SECRET=$ui_secret
CORE_SECRET=$core_secret
JOBSERVICE_SECRET=$jobservice_secret
ADMINSERVER_URL=$adminserver_url
GODEBUG=netdns=cgo

View File

@ -12,8 +12,8 @@ http {
# this is necessary for us to be able to disable request buffering in all cases
proxy_http_version 1.1;
upstream ui {
server ui:8080;
upstream core {
server core:8080;
}
upstream portal {
@ -47,7 +47,7 @@ http {
}
location /api/ {
proxy_pass http://ui/api/;
proxy_pass http://core/api/;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
@ -60,7 +60,7 @@ http {
}
location ~ ^/(login|log_out|sendEmail|language|reset|userExists|reset_password|chartrepo) {
proxy_pass http://ui/;
proxy_pass http://core/;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
@ -77,7 +77,7 @@ http {
}
location /v2/ {
proxy_pass http://ui/v2/;
proxy_pass http://core/v2/;
proxy_set_header Host $$http_host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
@ -89,7 +89,7 @@ http {
}
location /service/ {
proxy_pass http://ui/service/;
proxy_pass http://core/service/;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;

View File

@ -13,8 +13,8 @@ http {
# this is necessary for us to be able to disable request buffering in all cases
proxy_http_version 1.1;
upstream ui {
server ui:8080;
upstream core {
server core:8080;
}
upstream portal {
@ -67,7 +67,7 @@ http {
}
location /api/ {
proxy_pass http://ui/api/;
proxy_pass http://core/api/;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
@ -80,7 +80,7 @@ http {
}
location ~ ^/(login|log_out|sendEmail|language|reset|userExists|reset_password|chartrepo) {
proxy_pass http://ui;
proxy_pass http://core;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
@ -97,7 +97,7 @@ http {
}
location /v2/ {
proxy_pass http://ui/v2/;
proxy_pass http://core/v2/;
proxy_set_header Host $$http_host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
@ -109,7 +109,7 @@ http {
}
location /service/ {
proxy_pass http://ui/service/;
proxy_pass http://core/service/;
proxy_set_header Host $$http_host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;

View File

@ -31,7 +31,7 @@ notifications:
endpoints:
- name: harbor
disabled: false
url: $ui_url/service/notifications
url: $core_url/service/notifications
timeout: 3000ms
threshold: 5
backoff: 1s

View File

@ -1,3 +1,3 @@
UI_SECRET=$ui_secret
CORE_SECRET=$core_secret
JOBSERVICE_SECRET=$jobservice_secret

View File

@ -1,10 +1,10 @@
version: '2'
services:
ui:
core:
networks:
harbor-chartmuseum:
aliases:
- harbor-ui
- harbor-core
redis:
networks:
harbor-chartmuseum:

View File

@ -1,10 +1,10 @@
version: '2'
services:
ui:
core:
networks:
harbor-clair:
aliases:
- harbor-ui
- harbor-core
jobservice:
networks:
- harbor-clair

View File

@ -1,6 +1,6 @@
version: '2'
services:
ui:
core:
networks:
- harbor-notary
proxy:

View File

@ -86,19 +86,19 @@ services:
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "adminserver"
ui:
image: goharbor/harbor-ui:__version__
container_name: harbor-ui
core:
image: goharbor/harbor-core:__version__
container_name: harbor-core
env_file:
- ./common/config/ui/env
- ./common/config/core/env
restart: always
volumes:
- ./common/config/ui/app.conf:/etc/ui/app.conf:z
- ./common/config/ui/private_key.pem:/etc/ui/private_key.pem:z
- ./common/config/ui/certificates/:/etc/ui/certificates/:z
- /data/secretkey:/etc/ui/key:z
- /data/ca_download/:/etc/ui/ca/:z
- /data/psc/:/etc/ui/token/:z
- ./common/config/core/app.conf:/etc/core/app.conf:z
- ./common/config/core/private_key.pem:/etc/core/private_key.pem:z
- ./common/config/core/certificates/:/etc/core/certificates/:z
- /data/secretkey:/etc/core/key:z
- /data/ca_download/:/etc/core/ca/:z
- /data/psc/:/etc/core/token/:z
networks:
- harbor
depends_on:
@ -109,7 +109,7 @@ services:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "ui"
tag: "core"
portal:
image: goharbor/harbor-portal:__version__
container_name: harbor-portal
@ -118,7 +118,7 @@ services:
- harbor
depends_on:
- log
- ui
- core
logging:
driver: "syslog"
options:
@ -138,11 +138,11 @@ services:
- harbor
depends_on:
- redis
- ui
- core
- adminserver
logging:
driver: "syslog"
options:
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "jobservice"
redis:
@ -157,7 +157,7 @@ services:
- log
logging:
driver: "syslog"
options:
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "redis"
proxy:
@ -175,7 +175,7 @@ services:
depends_on:
- postgresql
- registry
- ui
- core
- portal
- log
logging:

View File

@ -176,11 +176,11 @@ spec:
configMapKeyRef:
name: harbor-adminserver-config
key: MAX_JOB_WORKERS
- name: UI_SECRET
- name: CORE_SECRET
valueFrom:
configMapKeyRef:
name: harbor-adminserver-config
key: UI_SECRET
key: CORE_SECRET
- name: JOBSERVICE_SECRET
valueFrom:
configMapKeyRef:

View File

@ -1,55 +1,55 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ui
name: core
labels:
name: ui
name: core
spec:
replicas: 1
template:
metadata:
labels:
name: ui-apps
name: core-apps
spec:
containers:
- name: ui-app
image: vmware/harbor-ui:v1.2.0
- name: core-app
image: vmware/harbor-core:v1.2.0
imagePullPolicy: IfNotPresent
env:
- name: CONFIG_PATH
valueFrom:
configMapKeyRef:
name: harbor-ui-config
name: harbor-core-config
key: CONFIG_PATH
- name: LOG_LEVEL
valueFrom:
configMapKeyRef:
name: harbor-ui-config
name: harbor-core-config
key: LOG_LEVEL
- name: UI_SECRET
- name: CORE_SECRET
valueFrom:
configMapKeyRef:
name: harbor-ui-config
key: UI_SECRET
name: harbor-core-config
key: CORE_SECRET
- name: JOBSERVICE_SECRET
valueFrom:
configMapKeyRef:
name: harbor-ui-config
name: harbor-core-config
key: JOBSERVICE_SECRET
- name: GODEBUG
valueFrom:
configMapKeyRef:
name: harbor-ui-config
name: harbor-core-config
key: GODEBUG
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /etc/ui
mountPath: /etc/core
volumes:
- name: config
configMap:
name: harbor-ui-config
name: harbor-core-config
items:
- key: config
path: app.conf

View File

@ -1,9 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: ui
name: core
spec:
ports:
- port: 80
selector:
name: ui-apps
name: core-apps

View File

@ -16,11 +16,11 @@ spec:
image: vmware/harbor-jobservice:v1.2.0
imagePullPolicy: IfNotPresent
env:
- name: UI_SECRET
- name: CORE_SECRET
valueFrom:
configMapKeyRef:
name: harbor-jobservice-config
key: UI_SECRET
key: CORE_SECRET
- name: JOBSERVICE_SECRET
valueFrom:
configMapKeyRef:

View File

@ -140,7 +140,7 @@ else:
if cert_path != '':
if os.path.isfile(cert_path):
with open(cert_path, 'r') as cert:
set_config('https_cert', cert.read())
set_config('https_cert', cert.read())i
else:
raise Exception('Error: https cert is not existing')
else:
@ -148,9 +148,9 @@ else:
# add configs
set_config('ui_url', get_config('ui_url_protocol') +
set_config('core_url', get_config('ui_url_protocol') +
'://' + get_config('hostname'))
set_config('ui_secret', ''.join(random.choice(
set_config('core_secret', ''.join(random.choice(
string.ascii_letters + string.digits) for i in range(16)))
# generate auth pkey & cert

View File

@ -21,7 +21,7 @@ data:
MYSQL_PWD: "{{db_password}}"
MYSQL_DATABASE: registry
REGISTRY_URL: http://registry:5000
TOKEN_SERVICE_URL: http://ui/service/token
TOKEN_SERVICE_URL: http://core/service/token
EMAIL_HOST: smtp.mydomain.com
EMAIL_PORT: "25"
EMAIL_USR: sample_admin@mydomain.com
@ -33,7 +33,7 @@ data:
PROJECT_CREATION_RESTRICTION: everyone
VERIFY_REMOTE_CERT: "on"
MAX_JOB_WORKERS: "{{max_job_workers}}"
UI_SECRET: "{{ui_secret}}"
CORE_SECRET: "{{core_secret}}"
JOBSERVICE_SECRET: "{{jobservice_secret}}"
TOKEN_EXPIRATION: "30"
CFG_EXPIRATION: "5"
@ -41,7 +41,7 @@ data:
ADMIRAL_URL: NA
WITH_NOTARY: "False"
RESET: "false"
EXT_ENDPOINT: "{{ui_url}}"
TOKEN_URL: http://ui
EXT_ENDPOINT: "{{core_url}}"
TOKEN_URL: http://core
JSON_CFG_STORE_PATH: "/etc/config/config.json"
SECRET_KEY: "{{secret_key}}"

View File

@ -9,7 +9,7 @@ spec:
paths:
- path: /
backend:
serviceName: ui
serviceName: core
servicePort: 80
- path: /v2
backend:
@ -17,6 +17,6 @@ spec:
servicePort: repo
- path: /service
backend:
serviceName: ui
serviceName: core
servicePort: 80

View File

@ -3,7 +3,7 @@ kind: ConfigMap
metadata:
name: harbor-jobservice-config
data:
UI_SECRET: "{{ui_secret}}"
CORE_SECRET: "{{core_secret}}"
JOBSERVICE_SECRET: "{{jobservice_secret}}"
SECRET_KEY: "{{secret_key}}"
MAX_JOB_WORKERS: "{{max_job_workers}}"

View File

@ -27,14 +27,14 @@ data:
auth:
token:
issuer: harbor-token-issuer
realm: {{ui_url}}/service/token
realm: {{core_url}}/service/token
rootcertbundle: /etc/registry/root.crt
service: harbor-registry
notifications:
endpoints:
- name: harbor
disabled: false
url: http://ui/service/notifications
url: http://core/service/notifications
timeout: 3000ms
threshold: 5
backoff: 1s

View File

@ -1,11 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: harbor-ui-config
name: harbor-core-config
data:
CONFIG_PATH: /etc/ui/app.conf
CONFIG_PATH: /etc/core/app.conf
LOG_LEVEL: debug
UI_SECRET: "{{ui_secret}}"
CORE_SECRET: "{{core_secret}}"
JOBSERVICE_SECRET: "{{jobservice_secret}}"
GODEBUG: netdns=cgo
SECRET_KEY: "{{secret_key}}"

View File

@ -25,9 +25,9 @@ DOCKERIMASES=$(DOCKERCMD) images
ADMINSERVERSOURCECODE=$(SRCPATH)/adminserver
ADMINSERVERBINARYPATH=$(MAKEDEVPATH)/adminserver
ADMINSERVERBINARYNAME=harbor_adminserver
UISOURCECODE=$(SRCPATH)/ui
UIBINARYPATH=$(MAKEDEVPATH)/ui
UIBINARYNAME=harbor_ui
CORE_SOURCECODE=$(SRCPATH)/core
CORE_BINARYPATH=$(MAKEDEVPATH)/core
CORE_BINARYNAME=harbor_core
JOBSERVICESOURCECODE=$(SRCPATH)/jobservice
JOBSERVICEBINARYPATH=$(MAKEDEVPATH)/jobservice
JOBSERVICEBINARYNAME=harbor_jobservice
@ -43,9 +43,9 @@ DOCKERFILEPATH_PORTAL=$(DOCKERFILEPATH)/portal
DOCKERFILENAME_PORTAL=Dockerfile
DOCKERIMAGENAME_PORTAL=goharbor/harbor-portal
DOCKERFILEPATH_UI=$(DOCKERFILEPATH)/ui
DOCKERFILENAME_UI=Dockerfile
DOCKERIMAGENAME_UI=goharbor/harbor-ui
DOCKERFILEPATH_CORE=$(DOCKERFILEPATH)/core
DOCKERFILENAME_CORE=Dockerfile
DOCKERIMAGENAME_CORE=goharbor/harbor-core
DOCKERFILEPATH_JOBSERVICE=$(DOCKERFILEPATH)/jobservice
DOCKERFILENAME_JOBSERVICE=Dockerfile
@ -115,9 +115,9 @@ _build_portal:
$(DOCKERBUILD) -f $(DOCKERFILEPATH_PORTAL)/$(DOCKERFILENAME_PORTAL) -t $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) .
@echo "Done."
_build_ui:
@echo "building ui container for photon..."
@$(DOCKERBUILD) -f $(DOCKERFILEPATH_UI)/$(DOCKERFILENAME_UI) -t $(DOCKERIMAGENAME_UI):$(VERSIONTAG) .
_build_core:
@echo "building core container for photon..."
@$(DOCKERBUILD) -f $(DOCKERFILEPATH_CORE)/$(DOCKERFILENAME_CORE) -t $(DOCKERIMAGENAME_CORE):$(VERSIONTAG) .
@echo "Done."
_build_jobservice:
@ -212,13 +212,13 @@ define _get_binary
$(WGET) --timeout 30 --no-check-certificate $1 -O $2
endef
build: _build_db _build_adminserver _build_portal _build_ui _build_jobservice _build_log _build_nginx _build_registry _build_registryctl _build_notary _build_clair _build_redis _build_migrator _build_chart_server
build: _build_db _build_adminserver _build_portal _build_core _build_jobservice _build_log _build_nginx _build_registry _build_registryctl _build_notary _build_clair _build_redis _build_migrator _build_chart_server
cleanimage:
@echo "cleaning image for photon..."
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_UI):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_CORE):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_LOG):$(VERSIONTAG)

View File

@ -8,11 +8,10 @@ RUN tdnf distro-sync -y \
&& mkdir /harbor/
HEALTHCHECK CMD curl --fail -s http://127.0.0.1:8080/api/ping || exit 1
COPY ./make/photon/ui/harbor_ui ./src/favicon.ico ./make/photon/ui/start.sh ./UIVERSION /harbor/
COPY ./src/ui/views /harbor/views
COPY ./src/ui/static /harbor/static
COPY ./make/photon/core/harbor_core ./make/photon/core/start.sh ./UIVERSION /harbor/
COPY ./src/core/views /harbor/views
RUN chmod u+x /harbor/start.sh /harbor/harbor_ui
RUN chmod u+x /harbor/start.sh /harbor/harbor_core
WORKDIR /harbor/
ENTRYPOINT ["/harbor/start.sh"]

View File

@ -0,0 +1,3 @@
#!/bin/sh
sudo -E -u \#10000 "/harbor/harbor_core"

View File

@ -8,10 +8,8 @@ ls -la
cat ./package.json
npm install
## Build harbor-ui and link it
rm -rf /build_dir/lib/dist
## Build harbor-portal and link it
npm run build_lib
chmod -R +xr /build_dir/lib/dist
npm run link_lib
## Build production

View File

@ -1,3 +0,0 @@
#!/bin/sh
sudo -E -u \#10000 "/harbor/harbor_ui"

View File

@ -21,6 +21,10 @@ if sys.version_info[:3][0] == 3:
DATA_VOL = "/data"
base_dir = os.path.dirname(__file__)
config_dir = os.path.join(base_dir, "common/config")
templates_dir = os.path.join(base_dir, "common/templates")
def validate(conf, args):
protocol = rcp.get("configuration", "ui_url_protocol")
@ -109,9 +113,6 @@ def render(src, dest, **kw):
f.write(t.substitute(**kw))
print("Generated configuration file: %s" % dest)
base_dir = os.path.dirname(__file__)
config_dir = os.path.join(base_dir, "common/config")
templates_dir = os.path.join(base_dir, "common/templates")
def delfile(src):
if os.path.isfile(src):
try:
@ -241,15 +242,15 @@ storage_provider_config = rcp.get("configuration", "registry_storage_provider_co
# yaml requires 1 or more spaces between the key and value
storage_provider_config = storage_provider_config.replace(":", ": ", 1)
registry_custom_ca_bundle_path = rcp.get("configuration", "registry_custom_ca_bundle").strip()
ui_secret = ''.join(random.choice(string.ascii_letters+string.digits) for i in range(16))
core_secret = ''.join(random.choice(string.ascii_letters+string.digits) for i in range(16))
jobservice_secret = ''.join(random.choice(string.ascii_letters+string.digits) for i in range(16))
adminserver_config_dir = os.path.join(config_dir,"adminserver")
if not os.path.exists(adminserver_config_dir):
os.makedirs(os.path.join(config_dir, "adminserver"))
ui_config_dir = prep_conf_dir(config_dir,"ui")
ui_certificates_dir = prep_conf_dir(ui_config_dir,"certificates")
core_config_dir = prep_conf_dir(config_dir,"core")
core_certificates_dir = prep_conf_dir(core_config_dir,"certificates")
db_config_dir = prep_conf_dir(config_dir, "db")
job_config_dir = prep_conf_dir(config_dir, "jobservice")
registry_config_dir = prep_conf_dir(config_dir, "registry")
@ -259,9 +260,9 @@ nginx_conf_d = prep_conf_dir(nginx_config_dir, "conf.d")
log_config_dir = prep_conf_dir (config_dir, "log")
adminserver_conf_env = os.path.join(config_dir, "adminserver", "env")
ui_conf_env = os.path.join(config_dir, "ui", "env")
ui_conf = os.path.join(config_dir, "ui", "app.conf")
ui_cert_dir = os.path.join(config_dir, "ui", "certificates")
core_conf_env = os.path.join(config_dir, "core", "env")
core_conf = os.path.join(config_dir, "core", "app.conf")
core_cert_dir = os.path.join(config_dir, "core", "certificates")
jobservice_conf = os.path.join(config_dir, "jobservice", "config.yml")
registry_conf = os.path.join(config_dir, "registry", "config.yml")
registryctl_conf_env = os.path.join(config_dir, "registryctl", "env")
@ -274,8 +275,8 @@ log_rotate_config = os.path.join(config_dir, "log", "logrotate.conf")
adminserver_url = "http://adminserver:8080"
registry_url = "http://registry:5000"
registry_controller_url = "http://registryctl:8080"
ui_url = "http://ui:8080"
token_service_url = "http://ui:8080/service/token"
core_url = "http://core:8080"
token_service_url = "http://core:8080/service/token"
jobservice_url = "http://jobservice:8080"
clair_url = "http://clair:6060"
@ -313,7 +314,7 @@ render(os.path.join(templates_dir, "adminserver", "env"),
adminserver_conf_env,
reload_config=reload_config,
public_url=public_url,
ui_url=ui_url,
core_url=core_url,
auth_mode=auth_mode,
self_registration=self_registration,
ldap_url=ldap_url,
@ -345,7 +346,7 @@ render(os.path.join(templates_dir, "adminserver", "env"),
harbor_admin_password=harbor_admin_password,
project_creation_restriction=proj_cre_restriction,
max_job_workers=max_job_workers,
ui_secret=ui_secret,
core_secret=core_secret,
jobservice_secret=jobservice_secret,
token_expiration=token_expiration,
admiral_url=admiral_url,
@ -379,9 +380,9 @@ chart_cache_driver = "memory"
if len(redis_host) > 0:
chart_cache_driver = "redis"
render(os.path.join(templates_dir, "ui", "env"),
ui_conf_env,
ui_secret=ui_secret,
render(os.path.join(templates_dir, "core", "env"),
core_conf_env,
core_secret=core_secret,
jobservice_secret=jobservice_secret,
redis_host=redis_host,
redis_port=redis_port,
@ -413,7 +414,7 @@ render(os.path.join(templates_dir, "registry", registry_config_file),
registry_conf,
storage_provider_info=storage_provider_info,
public_url=public_url,
ui_url=ui_url,
core_url=core_url,
redis_host=redis_host,
redis_port=redis_port,
redis_password=redis_password,
@ -425,7 +426,7 @@ render(os.path.join(templates_dir, "db", "env"),
render(os.path.join(templates_dir, "jobservice", "env"),
job_conf_env,
ui_secret=ui_secret,
core_secret=core_secret,
jobservice_secret=jobservice_secret,
adminserver_url=adminserver_url)
@ -442,19 +443,19 @@ render(os.path.join(templates_dir, "log", "logrotate.conf"),
render(os.path.join(templates_dir, "registryctl", "env"),
registryctl_conf_env,
jobservice_secret=jobservice_secret,
ui_secret=ui_secret)
core_secret=core_secret)
shutil.copyfile(os.path.join(templates_dir, "ui", "app.conf"), ui_conf)
shutil.copyfile(os.path.join(templates_dir, "core", "app.conf"), core_conf)
shutil.copyfile(os.path.join(templates_dir, "registryctl", "config.yml"), registryctl_conf_yml)
print("Generated configuration file: %s" % ui_conf)
print("Generated configuration file: %s" % core_conf)
if auth_mode == "uaa_auth":
if os.path.isfile(uaa_ca_cert):
if not os.path.isdir(ui_cert_dir):
os.makedirs(ui_cert_dir)
ui_uaa_ca = os.path.join(ui_cert_dir, "uaa_ca.pem")
print("Copying UAA CA cert to %s" % ui_uaa_ca)
shutil.copyfile(uaa_ca_cert, ui_uaa_ca)
if not os.path.isdir(core_cert_dir):
os.makedirs(core_cert_dir)
core_uaa_ca = os.path.join(core_cert_dir, "uaa_ca.pem")
print("Copying UAA CA cert to %s" % core_uaa_ca)
shutil.copyfile(uaa_ca_cert, core_uaa_ca)
else:
print("Can not find UAA CA cert: %s, skip" % uaa_ca_cert)
@ -508,14 +509,14 @@ def openssl_installed():
if customize_crt == 'on' and openssl_installed():
shell_stat = subprocess.check_call(["which", "openssl"], stdout=FNULL, stderr=subprocess.STDOUT)
empty_subj = "/"
private_key_pem = os.path.join(config_dir, "ui", "private_key.pem")
private_key_pem = os.path.join(config_dir, "core", "private_key.pem")
root_crt = os.path.join(config_dir, "registry", "root.crt")
create_root_cert(empty_subj, key_path=private_key_pem, cert_path=root_crt)
mark_file(private_key_pem)
mark_file(root_crt)
else:
print("Copied configuration file: %s" % ui_config_dir + "private_key.pem")
shutil.copyfile(os.path.join(templates_dir, "ui", "private_key.pem"), os.path.join(ui_config_dir, "private_key.pem"))
print("Copied configuration file: %s" % core_config_dir + "private_key.pem")
shutil.copyfile(os.path.join(templates_dir, "core", "private_key.pem"), os.path.join(core_config_dir, "private_key.pem"))
print("Copied configuration file: %s" % registry_config_dir + "root.crt")
shutil.copyfile(os.path.join(templates_dir, "registry", "root.crt"), os.path.join(registry_config_dir, "root.crt"))
@ -710,10 +711,10 @@ if args.chart_mode:
cache_redis_addr=cache_redis_addr,
cache_redis_password=cache_redis_password,
cache_redis_db_index=cache_redis_db_index,
ui_secret=ui_secret,
core_secret=core_secret,
storage_driver=storage_driver,
all_storage_driver_configs=all_storage_provider_configs)
FNULL.close()
print("The configuration files are ready, please use docker-compose to start the service.")

View File

@ -28,7 +28,7 @@ import (
func NewHandler() http.Handler {
h := newRouter()
secrets := map[string]string{
"uiSecret": os.Getenv("UI_SECRET"),
"uiSecret": os.Getenv("CORE_SECRET"),
"jobserviceSecret": os.Getenv("JOBSERVICE_SECRET"),
}
insecureAPIs := map[string]bool{

View File

@ -155,7 +155,7 @@ var (
env: "UAA_VERIFY_CERT",
parse: parseStringToBool,
},
common.UIURL: "UI_URL",
common.CoreURL: "CORE_URL",
common.JobServiceURL: "JOBSERVICE_URL",
common.TokenServiceURL: "TOKEN_SERVICE_URL",
common.ClairURL: "CLAIR_URL",
@ -220,7 +220,7 @@ var (
parse: parseStringToBool,
},
common.RegistryStorageProviderName: "REGISTRY_STORAGE_PROVIDER_NAME",
common.UIURL: "UI_URL",
common.CoreURL: "CORE_URL",
common.JobServiceURL: "JOBSERVICE_URL",
common.RegistryURL: "REGISTRY_URL",
common.TokenServiceURL: "TOKEN_SERVICE_URL",

View File

@ -11,8 +11,8 @@ import (
"regexp"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/ui/filter"
"github.com/goharbor/harbor/src/ui/promgr/metamgr"
"github.com/goharbor/harbor/src/core/filter"
"github.com/goharbor/harbor/src/core/promgr/metamgr"
)
// The backend server

View File

@ -12,7 +12,7 @@ import (
const (
userName = "chart_controller"
passwordKey = "UI_SECRET"
passwordKey = "CORE_SECRET"
)
// Credential keeps the username and password for the basic auth

View File

@ -10,7 +10,7 @@ import (
"time"
"github.com/ghodss/yaml"
"github.com/goharbor/harbor/src/ui/filter"
"github.com/goharbor/harbor/src/core/filter"
"k8s.io/helm/cmd/helm/search"
helm_repo "k8s.io/helm/pkg/repo"

View File

@ -49,7 +49,7 @@ const (
PostGreSQLDatabase = "postgresql_database"
PostGreSQLSSLMode = "postgresql_sslmode"
SelfRegistration = "self_registration"
UIURL = "ui_url"
CoreURL = "core_url"
JobServiceURL = "jobservice_url"
LDAPURL = "ldap_url"
LDAPSearchDN = "ldap_search_dn"
@ -106,7 +106,7 @@ const (
NotaryURL = "notary_url"
DefaultAdminserverEndpoint = "http://adminserver:8080"
DefaultJobserviceEndpoint = "http://jobservice:8080"
DefaultUIEndpoint = "http://ui:8080"
DefaultCoreEndpoint = "http://core:8080"
DefaultNotaryEndpoint = "http://notary-server:4443"
LdapGroupType = 1
ReloadKey = "reload_key"

View File

@ -23,9 +23,9 @@ import (
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
_ "github.com/goharbor/harbor/src/ui/auth/db"
_ "github.com/goharbor/harbor/src/ui/auth/ldap"
cfg "github.com/goharbor/harbor/src/ui/config"
_ "github.com/goharbor/harbor/src/core/auth/db"
_ "github.com/goharbor/harbor/src/core/auth/ldap"
cfg "github.com/goharbor/harbor/src/core/config"
)
func TestMain(m *testing.M) {

View File

@ -1,7 +1,7 @@
package task
import (
"github.com/goharbor/harbor/src/ui/utils"
"github.com/goharbor/harbor/src/core/utils"
)
// ScanAllTask is task of scanning all tags.

View File

@ -19,8 +19,8 @@ const (
AdminserverUser = "harbor-adminserver"
// JobserviceUser is the name of jobservice user
JobserviceUser = "harbor-jobservice"
// UIUser is the name of ui user
UIUser = "harbor-ui"
// CoreUser is the name of ui user
CoreUser = "harbor-core"
)
// Store the secrets and provides methods to validate secrets

View File

@ -19,7 +19,7 @@ import (
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/security/admiral/authcontext"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/promgr"
"github.com/goharbor/harbor/src/core/promgr"
)
// SecurityContext implements security.Context interface based on

View File

@ -20,7 +20,7 @@ import (
"github.com/goharbor/harbor/src/common/dao/group"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/promgr"
"github.com/goharbor/harbor/src/core/promgr"
)
// SecurityContext implements security.Context interface based on database

View File

@ -24,8 +24,8 @@ import (
"github.com/goharbor/harbor/src/common/dao/project"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/promgr"
"github.com/goharbor/harbor/src/ui/promgr/pmsdriver/local"
"github.com/goharbor/harbor/src/core/promgr"
"github.com/goharbor/harbor/src/core/promgr/pmsdriver/local"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -76,7 +76,7 @@ func (s *SecurityContext) HasReadPerm(projectIDOrName interface{}) bool {
if s.store == nil {
return false
}
return s.store.GetUsername(s.secret) == secret.JobserviceUser || s.store.GetUsername(s.secret) == secret.UIUser
return s.store.GetUsername(s.secret) == secret.JobserviceUser || s.store.GetUsername(s.secret) == secret.CoreUser
}
// HasWritePerm always returns false

View File

@ -25,7 +25,7 @@ import (
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/core/config"
goldap "gopkg.in/ldap.v2"
)

View File

@ -10,7 +10,7 @@ import (
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/common/utils/test"
uiConfig "github.com/goharbor/harbor/src/ui/config"
uiConfig "github.com/goharbor/harbor/src/core/config"
goldap "gopkg.in/ldap.v2"
)

View File

@ -29,8 +29,8 @@ import (
"github.com/docker/notary/tuf/data"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/common/utils/registry"
"github.com/goharbor/harbor/src/ui/config"
tokenutil "github.com/goharbor/harbor/src/ui/service/token"
"github.com/goharbor/harbor/src/core/config"
tokenutil "github.com/goharbor/harbor/src/core/service/token"
"github.com/opencontainers/go-digest"
)

View File

@ -20,7 +20,7 @@ import (
"github.com/goharbor/harbor/src/common"
notarytest "github.com/goharbor/harbor/src/common/utils/notary/test"
utilstest "github.com/goharbor/harbor/src/common/utils/test"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/core/config"
"github.com/stretchr/testify/assert"
"net/http/httptest"

View File

@ -26,7 +26,7 @@ import (
"github.com/goharbor/harbor/src/common/http/modifier"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
token_util "github.com/goharbor/harbor/src/ui/service/token"
token_util "github.com/goharbor/harbor/src/core/service/token"
)
const (

View File

@ -72,7 +72,7 @@ var adminServerDefaultConfig = map[string]interface{}{
common.UAAClientSecret: "testsecret",
common.UAAEndpoint: "10.192.168.5",
common.UAAVerifyCert: false,
common.UIURL: "http://myui:8888/",
common.CoreURL: "http://myui:8888/",
common.JobServiceURL: "http://myjob:8888/",
common.ReadOnly: false,
common.NotaryURL: "http://notary-server:4443",

View File

@ -20,10 +20,10 @@ import (
"github.com/goharbor/harbor/src/common/api"
"github.com/goharbor/harbor/src/common/security"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/ui/filter"
"github.com/goharbor/harbor/src/ui/promgr"
"github.com/goharbor/harbor/src/ui/utils"
"github.com/goharbor/harbor/src/core/config"
"github.com/goharbor/harbor/src/core/filter"
"github.com/goharbor/harbor/src/core/promgr"
"github.com/goharbor/harbor/src/core/utils"
)
// BaseController ...

View File

@ -14,7 +14,7 @@ import (
"github.com/goharbor/harbor/src/chartserver"
hlog "github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/core/config"
)
const (

View File

@ -6,7 +6,7 @@ import (
"testing"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/ui/promgr/metamgr"
"github.com/goharbor/harbor/src/core/promgr/metamgr"
)
// Test the URL rewrite function

View File

@ -23,7 +23,7 @@ import (
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/core/config"
)
// ConfigAPI ...

View File

@ -19,7 +19,7 @@ import (
"testing"
"github.com/goharbor/harbor/src/common"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/core/config"
"github.com/stretchr/testify/assert"
)

View File

@ -21,7 +21,7 @@ import (
"github.com/goharbor/harbor/src/common/utils/email"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/core/config"
)
const (

View File

@ -32,8 +32,8 @@ import (
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils"
ldapUtils "github.com/goharbor/harbor/src/common/utils/ldap"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/ui/filter"
"github.com/goharbor/harbor/src/core/config"
"github.com/goharbor/harbor/src/core/filter"
"github.com/goharbor/harbor/tests/apitests/apilib"
// "strconv"
// "strings"
@ -42,10 +42,10 @@ import (
"github.com/dghubble/sling"
// for test env prepare
_ "github.com/goharbor/harbor/src/core/auth/db"
_ "github.com/goharbor/harbor/src/core/auth/ldap"
"github.com/goharbor/harbor/src/replication/core"
_ "github.com/goharbor/harbor/src/replication/event"
_ "github.com/goharbor/harbor/src/ui/auth/db"
_ "github.com/goharbor/harbor/src/ui/auth/ldap"
)
const (

View File

@ -5,7 +5,7 @@ import (
"strconv"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/ui/label"
"github.com/goharbor/harbor/src/core/label"
)
// LabelResourceAPI provides the related basic functions to handle marking labels to resources

View File

@ -20,7 +20,7 @@ import (
"github.com/goharbor/harbor/src/common/models"
ldapUtils "github.com/goharbor/harbor/src/common/utils/ldap"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/auth"
"github.com/goharbor/harbor/src/core/auth"
goldap "gopkg.in/ldap.v2"
)

View File

@ -23,7 +23,7 @@ import (
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/promgr/metamgr"
"github.com/goharbor/harbor/src/core/promgr/metamgr"
)
// MetadataAPI ...

View File

@ -17,14 +17,14 @@ package models
import (
"encoding/json"
"fmt"
"time"
"github.com/astaxie/beego/validation"
"github.com/goharbor/harbor/src/common/job"
"github.com/goharbor/harbor/src/common/job/models"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/config"
"time"
"github.com/goharbor/harbor/src/core/config"
)
const (
@ -107,7 +107,7 @@ func (gr *GCReq) ToJob() (*models.JobData, error) {
Parameters: gr.Parameters,
Metadata: metadata,
StatusHook: fmt.Sprintf("%s/service/notifications/jobs/adminjob/%d",
config.InternalUIURL(), gr.ID),
config.InternalCoreURL(), gr.ID),
}
return jobData, nil
}

View File

@ -25,7 +25,7 @@ import (
)
var adminServerTestConfig = map[string]interface{}{
common.DefaultUIEndpoint: "test",
common.DefaultCoreEndpoint: "test",
}
func TestMain(m *testing.M) {

View File

@ -25,7 +25,7 @@ import (
"github.com/goharbor/harbor/src/common/utils"
errutil "github.com/goharbor/harbor/src/common/utils/error"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/config"
"github.com/goharbor/harbor/src/core/config"
"strconv"
"time"

View File

@ -25,7 +25,7 @@ import (
"github.com/goharbor/harbor/src/common/dao/project"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/auth"
"github.com/goharbor/harbor/src/core/auth"
)
// ProjectMemberAPI handles request to /api/projects/{}/members/{}

View File

@ -26,8 +26,8 @@ import (
common_job "github.com/goharbor/harbor/src/common/job"
common_models "github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/api/models"
utils_ui "github.com/goharbor/harbor/src/ui/utils"
"github.com/goharbor/harbor/src/core/api/models"
utils_core "github.com/goharbor/harbor/src/core/utils"
)
// GCAPI handles request of harbor admin...
@ -81,7 +81,7 @@ func (gc *GCAPI) Put() {
}
// stop the scheduled job and remove it.
if err = utils_ui.GetJobServiceClient().PostAction(jobs[0].UUID, common_job.JobActionStop); err != nil {
if err = utils_core.GetJobServiceClient().PostAction(jobs[0].UUID, common_job.JobActionStop); err != nil {
if e, ok := err.(*common_http.Error); !ok || e.Code != http.StatusNotFound {
gc.HandleInternalServerError(fmt.Sprintf("%v", err))
return
@ -193,7 +193,7 @@ func (gc *GCAPI) GetLog() {
gc.CustomAbort(http.StatusNotFound, "Failed to get Job")
}
logBytes, err := utils_ui.GetJobServiceClient().GetJobLog(job.UUID)
logBytes, err := utils_core.GetJobServiceClient().GetJobLog(job.UUID)
if err != nil {
if httpErr, ok := err.(*common_http.Error); ok {
gc.RenderError(httpErr.Code, "")
@ -251,7 +251,7 @@ func (gc *GCAPI) submitJob(gr *models.GCReq) {
// submit job to jobservice
log.Debugf("submiting GC admin job to jobservice")
_, err = utils_ui.GetJobServiceClient().SubmitJob(job)
_, err = utils_core.GetJobServiceClient().SubmitJob(job)
if err != nil {
if err := dao.DeleteAdminJob(id); err != nil {
log.Debugf("Failed to delete admin job, err: %v", err)

View File

@ -4,7 +4,7 @@ import (
"testing"
common_models "github.com/goharbor/harbor/src/common/models"
api_modes "github.com/goharbor/harbor/src/ui/api/models"
api_modes "github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/tests/apitests/apilib"
"github.com/stretchr/testify/assert"
)

View File

@ -22,10 +22,10 @@ import (
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/notifier"
"github.com/goharbor/harbor/src/common/utils/log"
api_models "github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/src/replication/core"
"github.com/goharbor/harbor/src/replication/event/notification"
"github.com/goharbor/harbor/src/replication/event/topic"
api_models "github.com/goharbor/harbor/src/ui/api/models"
)
// ReplicationAPI handles API calls for replication

View File

@ -25,9 +25,9 @@ import (
common_job "github.com/goharbor/harbor/src/common/job"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
api_models "github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/src/core/utils"
"github.com/goharbor/harbor/src/replication/core"
api_models "github.com/goharbor/harbor/src/ui/api/models"
"github.com/goharbor/harbor/src/ui/utils"
)
// RepJobAPI handles request to /api/replicationJobs /api/replicationJobs/:id/log

View File

@ -23,11 +23,11 @@ import (
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils/log"
api_models "github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/src/core/promgr"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/core"
rep_models "github.com/goharbor/harbor/src/replication/models"
api_models "github.com/goharbor/harbor/src/ui/api/models"
"github.com/goharbor/harbor/src/ui/promgr"
)
// RepPolicyAPI handles /api/replicationPolicies /api/replicationPolicies/:id/enablement

View File

@ -24,9 +24,9 @@ import (
"github.com/goharbor/harbor/src/common"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
api_models "github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/src/replication"
rep_models "github.com/goharbor/harbor/src/replication/models"
api_models "github.com/goharbor/harbor/src/ui/api/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -20,8 +20,8 @@ import (
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
api_models "github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/src/replication"
api_models "github.com/goharbor/harbor/src/ui/api/models"
"github.com/stretchr/testify/require"
)

View File

@ -36,10 +36,10 @@ import (
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/common/utils/notary"
"github.com/goharbor/harbor/src/common/utils/registry"
"github.com/goharbor/harbor/src/core/config"
coreutils "github.com/goharbor/harbor/src/core/utils"
"github.com/goharbor/harbor/src/replication/event/notification"
"github.com/goharbor/harbor/src/replication/event/topic"
"github.com/goharbor/harbor/src/ui/config"
uiutils "github.com/goharbor/harbor/src/ui/utils"
)
// RepositoryAPI handles request to /api/repositories /api/repositories/tags /api/repositories/manifests, the parm has to be put
@ -251,7 +251,7 @@ func (ra *RepositoryAPI) Delete() {
return
}
rc, err := uiutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repoName)
rc, err := coreutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repoName)
if err != nil {
log.Errorf("error occurred while initializing repository client for %s: %v", repoName, err)
ra.CustomAbort(http.StatusInternalServerError, "internal error")
@ -401,7 +401,7 @@ func (ra *RepositoryAPI) GetTag() {
return
}
client, err := uiutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repository)
client, err := coreutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repository)
if err != nil {
ra.HandleInternalServerError(fmt.Sprintf("failed to initialize the client for %s: %v",
repository, err))
@ -455,7 +455,7 @@ func (ra *RepositoryAPI) GetTags() {
return
}
client, err := uiutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repoName)
client, err := coreutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repoName)
if err != nil {
log.Errorf("error occurred while initializing repository client for %s: %v", repoName, err)
ra.CustomAbort(http.StatusInternalServerError, "internal error")
@ -664,7 +664,7 @@ func (ra *RepositoryAPI) GetManifests() {
return
}
rc, err := uiutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repoName)
rc, err := coreutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repoName)
if err != nil {
log.Errorf("error occurred while initializing repository client for %s: %v", repoName, err)
ra.CustomAbort(http.StatusInternalServerError, "internal error")
@ -866,7 +866,7 @@ func (ra *RepositoryAPI) ScanImage() {
ra.HandleForbidden(ra.SecurityCtx.GetUsername())
return
}
err = uiutils.TriggerImageScan(repoName, tag)
err = coreutils.TriggerImageScan(repoName, tag)
if err != nil {
log.Errorf("Error while calling job service to trigger image scan: %v", err)
ra.HandleInternalServerError("Failed to scan image, please check log for details")
@ -943,7 +943,7 @@ func (ra *RepositoryAPI) ScanAll() {
ra.HandleForbidden(ra.SecurityCtx.GetUsername())
return
}
if err := uiutils.ScanImagesByProjectID(pid); err != nil {
if err := coreutils.ScanImagesByProjectID(pid); err != nil {
log.Errorf("Failed triggering scan images in project: %d, error: %v", pid, err)
ra.HandleInternalServerError(fmt.Sprintf("Error: %v", err))
return
@ -959,7 +959,7 @@ func (ra *RepositoryAPI) ScanAll() {
return
}
if err := uiutils.ScanAllImages(); err != nil {
if err := coreutils.ScanAllImages(); err != nil {
log.Errorf("Failed triggering scan all images, error: %v", err)
ra.HandleInternalServerError(fmt.Sprintf("Error: %v", err))
return
@ -998,7 +998,7 @@ func (ra *RepositoryAPI) checkExistence(repository, tag string) (bool, string, e
log.Errorf("project %s not found", project)
return false, "", nil
}
client, err := uiutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repository)
client, err := coreutils.NewRepositoryClientForUI(ra.SecurityCtx.GetUsername(), repository)
if err != nil {
return false, "", fmt.Errorf("failed to initialize the client for %s: %v", repository, err)
}

View File

@ -23,7 +23,7 @@ import (
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils"
uiutils "github.com/goharbor/harbor/src/ui/utils"
coreutils "github.com/goharbor/harbor/src/core/utils"
)
// RepositoryLabelAPI handles requests for adding/removing label to/from repositories and images
@ -154,7 +154,7 @@ func (r *RepositoryLabelAPI) RemoveFromRepository() {
}
func imageExist(username, repository, tag string) (bool, error) {
client, err := uiutils.NewRepositoryClientForUI(username, repository)
client, err := coreutils.NewRepositoryClientForUI(username, repository)
if err != nil {
return false, err
}

View File

@ -18,7 +18,7 @@ import (
"github.com/goharbor/harbor/src/common/dao"
common_http "github.com/goharbor/harbor/src/common/http"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/ui/utils"
"github.com/goharbor/harbor/src/core/utils"
"fmt"
"net/http"

View File

@ -24,7 +24,7 @@ import (
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/common/utils/log"
uiutils "github.com/goharbor/harbor/src/ui/utils"
coreutils "github.com/goharbor/harbor/src/core/utils"
"k8s.io/helm/cmd/helm/search"
)
@ -190,7 +190,7 @@ func filterRepositories(projects []*models.Project, keyword string) (
}
func getTags(repository string) ([]string, error) {
client, err := uiutils.NewRepositoryClientForUI("harbor-ui", repository)
client, err := coreutils.NewRepositoryClientForUI("harbor-core", repository)
if err != nil {
return nil, err
}

Some files were not shown because too many files have changed in this diff Show More