diff --git a/.gitignore b/.gitignore index d85ad3d6f..98660218e 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/.travis.yml b/.travis.yml index ce3f94268..df896b7e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Makefile b/Makefile index 6d7a7af82..8eac8ef12 100644 --- a/Makefile +++ b/Makefile @@ -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" diff --git a/docs/configure_swagger.md b/docs/configure_swagger.md index 2d07cc571..50ca6247f 100644 --- a/docs/configure_swagger.md +++ b/docs/configure_swagger.md @@ -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 diff --git a/docs/installation_guide.md b/docs/installation_guide.md index 3c69a50d3..082048b20 100644 --- a/docs/installation_guide.md +++ b/docs/installation_guide.md @@ -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/`. diff --git a/make/common/templates/adminserver/env b/make/common/templates/adminserver/env index bbfc92756..96a46d3e8 100644 --- a/make/common/templates/adminserver/env +++ b/make/common/templates/adminserver/env @@ -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 diff --git a/make/common/templates/chartserver/env b/make/common/templates/chartserver/env index 205465ba6..510f7e2f7 100644 --- a/make/common/templates/chartserver/env +++ b/make/common/templates/chartserver/env @@ -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 diff --git a/make/common/templates/clair/config.yaml b/make/common/templates/clair/config.yaml index 151901251..2f6e6cd5d 100644 --- a/make/common/templates/clair/config.yaml +++ b/make/common/templates/clair/config.yaml @@ -22,4 +22,4 @@ clair: attempts: 3 renotifyinterval: 2h http: - endpoint: http://ui:8080/service/notifications/clair + endpoint: http://core:8080/service/notifications/clair diff --git a/make/common/templates/ui/app.conf b/make/common/templates/core/app.conf similarity index 100% rename from make/common/templates/ui/app.conf rename to make/common/templates/core/app.conf diff --git a/make/common/templates/ui/env b/make/common/templates/core/env similarity index 70% rename from make/common/templates/ui/env rename to make/common/templates/core/env index fc9dedfb2..3402c5014 100644 --- a/make/common/templates/ui/env +++ b/make/common/templates/core/env @@ -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 diff --git a/make/common/templates/ui/private_key.pem b/make/common/templates/core/private_key.pem similarity index 100% rename from make/common/templates/ui/private_key.pem rename to make/common/templates/core/private_key.pem diff --git a/make/common/templates/jobservice/env b/make/common/templates/jobservice/env index c39f1f71c..51ce015a1 100644 --- a/make/common/templates/jobservice/env +++ b/make/common/templates/jobservice/env @@ -1,4 +1,4 @@ -UI_SECRET=$ui_secret +CORE_SECRET=$core_secret JOBSERVICE_SECRET=$jobservice_secret ADMINSERVER_URL=$adminserver_url GODEBUG=netdns=cgo diff --git a/make/common/templates/nginx/nginx.http.conf b/make/common/templates/nginx/nginx.http.conf index 4a9888b35..6f79f33d8 100644 --- a/make/common/templates/nginx/nginx.http.conf +++ b/make/common/templates/nginx/nginx.http.conf @@ -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; diff --git a/make/common/templates/nginx/nginx.https.conf b/make/common/templates/nginx/nginx.https.conf index 6ae4bd3ea..b8ea1dc5f 100644 --- a/make/common/templates/nginx/nginx.https.conf +++ b/make/common/templates/nginx/nginx.https.conf @@ -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; diff --git a/make/common/templates/registry/config.yml b/make/common/templates/registry/config.yml index 6190baf78..419d3494e 100644 --- a/make/common/templates/registry/config.yml +++ b/make/common/templates/registry/config.yml @@ -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 diff --git a/make/common/templates/registryctl/env b/make/common/templates/registryctl/env index 188efbcf4..8fb7a92a1 100644 --- a/make/common/templates/registryctl/env +++ b/make/common/templates/registryctl/env @@ -1,3 +1,3 @@ -UI_SECRET=$ui_secret +CORE_SECRET=$core_secret JOBSERVICE_SECRET=$jobservice_secret diff --git a/make/docker-compose.chartmuseum.tpl b/make/docker-compose.chartmuseum.tpl index ed47bc769..1d540bacc 100644 --- a/make/docker-compose.chartmuseum.tpl +++ b/make/docker-compose.chartmuseum.tpl @@ -1,10 +1,10 @@ version: '2' services: - ui: + core: networks: harbor-chartmuseum: aliases: - - harbor-ui + - harbor-core redis: networks: harbor-chartmuseum: diff --git a/make/docker-compose.clair.tpl b/make/docker-compose.clair.tpl index 757d6ad84..e1a938c89 100644 --- a/make/docker-compose.clair.tpl +++ b/make/docker-compose.clair.tpl @@ -1,10 +1,10 @@ version: '2' services: - ui: + core: networks: harbor-clair: aliases: - - harbor-ui + - harbor-core jobservice: networks: - harbor-clair diff --git a/make/docker-compose.notary.tpl b/make/docker-compose.notary.tpl index aabb13fad..100a33e27 100644 --- a/make/docker-compose.notary.tpl +++ b/make/docker-compose.notary.tpl @@ -1,6 +1,6 @@ version: '2' services: - ui: + core: networks: - harbor-notary proxy: diff --git a/make/docker-compose.tpl b/make/docker-compose.tpl index 84b406eb6..d56df3fa3 100644 --- a/make/docker-compose.tpl +++ b/make/docker-compose.tpl @@ -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: diff --git a/make/kubernetes/adminserver/adminserver.deploy.yaml b/make/kubernetes/adminserver/adminserver.deploy.yaml index e1e2efaa3..ccc0e6187 100644 --- a/make/kubernetes/adminserver/adminserver.deploy.yaml +++ b/make/kubernetes/adminserver/adminserver.deploy.yaml @@ -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: diff --git a/make/kubernetes/ui/ui.deploy.yaml b/make/kubernetes/core/core.deploy.yaml similarity index 70% rename from make/kubernetes/ui/ui.deploy.yaml rename to make/kubernetes/core/core.deploy.yaml index 50c8d190a..823b71b32 100644 --- a/make/kubernetes/ui/ui.deploy.yaml +++ b/make/kubernetes/core/core.deploy.yaml @@ -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 diff --git a/make/kubernetes/ui/ui.svc.yaml b/make/kubernetes/core/core.svc.yaml similarity index 71% rename from make/kubernetes/ui/ui.svc.yaml rename to make/kubernetes/core/core.svc.yaml index bfac5995f..974db290d 100644 --- a/make/kubernetes/ui/ui.svc.yaml +++ b/make/kubernetes/core/core.svc.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: ui + name: core spec: ports: - port: 80 selector: - name: ui-apps + name: core-apps diff --git a/make/kubernetes/jobservice/jobservice.deploy.yaml b/make/kubernetes/jobservice/jobservice.deploy.yaml index 4e18db0e5..e7cf339bf 100644 --- a/make/kubernetes/jobservice/jobservice.deploy.yaml +++ b/make/kubernetes/jobservice/jobservice.deploy.yaml @@ -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: diff --git a/make/kubernetes/k8s-prepare b/make/kubernetes/k8s-prepare index a8c15a661..9f9ed1cf8 100755 --- a/make/kubernetes/k8s-prepare +++ b/make/kubernetes/k8s-prepare @@ -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 diff --git a/make/kubernetes/templates/adminserver.cm.yaml b/make/kubernetes/templates/adminserver.cm.yaml index 40f9ff1f6..e1d2b75d5 100644 --- a/make/kubernetes/templates/adminserver.cm.yaml +++ b/make/kubernetes/templates/adminserver.cm.yaml @@ -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}}" diff --git a/make/kubernetes/templates/ingress.yaml b/make/kubernetes/templates/ingress.yaml index 5ad84da5c..b1770ed74 100644 --- a/make/kubernetes/templates/ingress.yaml +++ b/make/kubernetes/templates/ingress.yaml @@ -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 diff --git a/make/kubernetes/templates/jobservice.cm.yaml b/make/kubernetes/templates/jobservice.cm.yaml index a58b3b04b..d9faf6bc9 100644 --- a/make/kubernetes/templates/jobservice.cm.yaml +++ b/make/kubernetes/templates/jobservice.cm.yaml @@ -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}}" diff --git a/make/kubernetes/templates/registry.cm.yaml b/make/kubernetes/templates/registry.cm.yaml index 7184d88f4..a9fe3fdaf 100644 --- a/make/kubernetes/templates/registry.cm.yaml +++ b/make/kubernetes/templates/registry.cm.yaml @@ -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 diff --git a/make/kubernetes/templates/ui.cm.yaml b/make/kubernetes/templates/ui.cm.yaml index 659ec6d3c..be444bd35 100644 --- a/make/kubernetes/templates/ui.cm.yaml +++ b/make/kubernetes/templates/ui.cm.yaml @@ -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}}" diff --git a/make/photon/Makefile b/make/photon/Makefile index dc9781cfb..e8d1f78a5 100644 --- a/make/photon/Makefile +++ b/make/photon/Makefile @@ -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) diff --git a/make/photon/ui/Dockerfile b/make/photon/core/Dockerfile similarity index 63% rename from make/photon/ui/Dockerfile rename to make/photon/core/Dockerfile index fcf8f15d5..5bc7be921 100644 --- a/make/photon/ui/Dockerfile +++ b/make/photon/core/Dockerfile @@ -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"] diff --git a/make/photon/core/start.sh b/make/photon/core/start.sh new file mode 100644 index 000000000..20267e671 --- /dev/null +++ b/make/photon/core/start.sh @@ -0,0 +1,3 @@ +#!/bin/sh +sudo -E -u \#10000 "/harbor/harbor_core" + diff --git a/make/photon/portal/entrypoint.sh b/make/photon/portal/entrypoint.sh index babfb993b..3b1350906 100644 --- a/make/photon/portal/entrypoint.sh +++ b/make/photon/portal/entrypoint.sh @@ -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 diff --git a/make/photon/ui/start.sh b/make/photon/ui/start.sh deleted file mode 100644 index db1385302..000000000 --- a/make/photon/ui/start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -sudo -E -u \#10000 "/harbor/harbor_ui" - diff --git a/make/prepare b/make/prepare index cfcf3c8e9..f82c2eedc 100755 --- a/make/prepare +++ b/make/prepare @@ -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.") diff --git a/src/adminserver/handlers/handler.go b/src/adminserver/handlers/handler.go index 3652ef515..20f5b7d30 100644 --- a/src/adminserver/handlers/handler.go +++ b/src/adminserver/handlers/handler.go @@ -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{ diff --git a/src/adminserver/systemcfg/systemcfg.go b/src/adminserver/systemcfg/systemcfg.go index ddb260055..9f51bfc3a 100644 --- a/src/adminserver/systemcfg/systemcfg.go +++ b/src/adminserver/systemcfg/systemcfg.go @@ -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", diff --git a/src/chartserver/base_test.go b/src/chartserver/base_test.go index ab7bc4c72..1983eae30 100644 --- a/src/chartserver/base_test.go +++ b/src/chartserver/base_test.go @@ -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 diff --git a/src/chartserver/controller.go b/src/chartserver/controller.go index 6603047aa..b4de99293 100644 --- a/src/chartserver/controller.go +++ b/src/chartserver/controller.go @@ -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 diff --git a/src/chartserver/repo_handler.go b/src/chartserver/repo_handler.go index 31330bc9e..3309353ec 100644 --- a/src/chartserver/repo_handler.go +++ b/src/chartserver/repo_handler.go @@ -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" diff --git a/src/common/const.go b/src/common/const.go index c0f42420d..0cb4762cf 100644 --- a/src/common/const.go +++ b/src/common/const.go @@ -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" diff --git a/src/common/dao/project/projectmember_test.go b/src/common/dao/project/projectmember_test.go index bc79cf06d..6f92d3eeb 100644 --- a/src/common/dao/project/projectmember_test.go +++ b/src/common/dao/project/projectmember_test.go @@ -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) { diff --git a/src/common/scheduler/task/scan_all_task.go b/src/common/scheduler/task/scan_all_task.go index d8ddbedd6..11837d0c2 100644 --- a/src/common/scheduler/task/scan_all_task.go +++ b/src/common/scheduler/task/scan_all_task.go @@ -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. diff --git a/src/common/secret/store.go b/src/common/secret/store.go index 7a0a10d7f..0594915c1 100644 --- a/src/common/secret/store.go +++ b/src/common/secret/store.go @@ -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 diff --git a/src/common/security/admiral/context.go b/src/common/security/admiral/context.go index ef966d8fc..9bc7a4f70 100644 --- a/src/common/security/admiral/context.go +++ b/src/common/security/admiral/context.go @@ -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 diff --git a/src/common/security/local/context.go b/src/common/security/local/context.go index 9d95b7658..d4f16959e 100644 --- a/src/common/security/local/context.go +++ b/src/common/security/local/context.go @@ -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 diff --git a/src/common/security/local/context_test.go b/src/common/security/local/context_test.go index 0fa389876..b49bef02a 100644 --- a/src/common/security/local/context_test.go +++ b/src/common/security/local/context_test.go @@ -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" ) diff --git a/src/common/security/secret/context.go b/src/common/security/secret/context.go index f4642dd5e..1b844a126 100644 --- a/src/common/security/secret/context.go +++ b/src/common/security/secret/context.go @@ -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 diff --git a/src/common/utils/ldap/ldap.go b/src/common/utils/ldap/ldap.go index 4788d433b..57ec378b9 100644 --- a/src/common/utils/ldap/ldap.go +++ b/src/common/utils/ldap/ldap.go @@ -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" ) diff --git a/src/common/utils/ldap/ldap_test.go b/src/common/utils/ldap/ldap_test.go index 56bb92e40..fd22a4b0f 100644 --- a/src/common/utils/ldap/ldap_test.go +++ b/src/common/utils/ldap/ldap_test.go @@ -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" ) diff --git a/src/common/utils/notary/helper.go b/src/common/utils/notary/helper.go index 7aaaa6c30..a3f837e6a 100644 --- a/src/common/utils/notary/helper.go +++ b/src/common/utils/notary/helper.go @@ -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" ) diff --git a/src/common/utils/notary/helper_test.go b/src/common/utils/notary/helper_test.go index 09f631ea7..846cf141c 100644 --- a/src/common/utils/notary/helper_test.go +++ b/src/common/utils/notary/helper_test.go @@ -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" diff --git a/src/common/utils/registry/auth/tokenauthorizer.go b/src/common/utils/registry/auth/tokenauthorizer.go index f2cb138a6..bfd7424cc 100644 --- a/src/common/utils/registry/auth/tokenauthorizer.go +++ b/src/common/utils/registry/auth/tokenauthorizer.go @@ -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 ( diff --git a/src/common/utils/test/adminserver.go b/src/common/utils/test/adminserver.go index 9d0098fa1..dd69cb94e 100644 --- a/src/common/utils/test/adminserver.go +++ b/src/common/utils/test/adminserver.go @@ -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", diff --git a/src/ui/api/api_test.go b/src/core/api/api_test.go similarity index 100% rename from src/ui/api/api_test.go rename to src/core/api/api_test.go diff --git a/src/ui/api/base.go b/src/core/api/base.go similarity index 94% rename from src/ui/api/base.go rename to src/core/api/base.go index 2abe521a9..f1b68b5eb 100644 --- a/src/ui/api/base.go +++ b/src/core/api/base.go @@ -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 ... diff --git a/src/ui/api/chart_label.go b/src/core/api/chart_label.go similarity index 100% rename from src/ui/api/chart_label.go rename to src/core/api/chart_label.go diff --git a/src/ui/api/chart_label_test.go b/src/core/api/chart_label_test.go similarity index 100% rename from src/ui/api/chart_label_test.go rename to src/core/api/chart_label_test.go diff --git a/src/ui/api/chart_repository.go b/src/core/api/chart_repository.go similarity index 99% rename from src/ui/api/chart_repository.go rename to src/core/api/chart_repository.go index b3652293c..b59022589 100644 --- a/src/ui/api/chart_repository.go +++ b/src/core/api/chart_repository.go @@ -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 ( diff --git a/src/ui/api/chart_repository_test.go b/src/core/api/chart_repository_test.go similarity index 99% rename from src/ui/api/chart_repository_test.go rename to src/core/api/chart_repository_test.go index 820c24161..3b429d45b 100644 --- a/src/ui/api/chart_repository_test.go +++ b/src/core/api/chart_repository_test.go @@ -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 diff --git a/src/ui/api/config.go b/src/core/api/config.go similarity index 99% rename from src/ui/api/config.go rename to src/core/api/config.go index 293f5d903..59cce1e37 100644 --- a/src/ui/api/config.go +++ b/src/core/api/config.go @@ -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 ... diff --git a/src/ui/api/config_test.go b/src/core/api/config_test.go similarity index 99% rename from src/ui/api/config_test.go rename to src/core/api/config_test.go index 4b0a6b551..f5d25f60a 100644 --- a/src/ui/api/config_test.go +++ b/src/core/api/config_test.go @@ -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" ) diff --git a/src/ui/api/dataprepare_test.go b/src/core/api/dataprepare_test.go similarity index 100% rename from src/ui/api/dataprepare_test.go rename to src/core/api/dataprepare_test.go diff --git a/src/ui/api/email.go b/src/core/api/email.go similarity index 98% rename from src/ui/api/email.go rename to src/core/api/email.go index 037e2602f..f291e51dd 100644 --- a/src/ui/api/email.go +++ b/src/core/api/email.go @@ -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 ( diff --git a/src/ui/api/email_test.go b/src/core/api/email_test.go similarity index 100% rename from src/ui/api/email_test.go rename to src/core/api/email_test.go diff --git a/src/ui/api/harborapi_test.go b/src/core/api/harborapi_test.go similarity index 99% rename from src/ui/api/harborapi_test.go rename to src/core/api/harborapi_test.go index 5cc12a567..f690c7dc7 100644 --- a/src/ui/api/harborapi_test.go +++ b/src/core/api/harborapi_test.go @@ -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 ( diff --git a/src/ui/api/internal.go b/src/core/api/internal.go similarity index 100% rename from src/ui/api/internal.go rename to src/core/api/internal.go diff --git a/src/ui/api/label.go b/src/core/api/label.go similarity index 100% rename from src/ui/api/label.go rename to src/core/api/label.go diff --git a/src/ui/api/label_resource.go b/src/core/api/label_resource.go similarity index 98% rename from src/ui/api/label_resource.go rename to src/core/api/label_resource.go index ba590a3aa..4fc96637b 100644 --- a/src/ui/api/label_resource.go +++ b/src/core/api/label_resource.go @@ -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 diff --git a/src/ui/api/label_test.go b/src/core/api/label_test.go similarity index 100% rename from src/ui/api/label_test.go rename to src/core/api/label_test.go diff --git a/src/ui/api/ldap.go b/src/core/api/ldap.go similarity index 99% rename from src/ui/api/ldap.go rename to src/core/api/ldap.go index 0f9922431..9472ce56e 100644 --- a/src/ui/api/ldap.go +++ b/src/core/api/ldap.go @@ -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" ) diff --git a/src/ui/api/ldap_test.go b/src/core/api/ldap_test.go similarity index 100% rename from src/ui/api/ldap_test.go rename to src/core/api/ldap_test.go diff --git a/src/ui/api/log.go b/src/core/api/log.go similarity index 100% rename from src/ui/api/log.go rename to src/core/api/log.go diff --git a/src/ui/api/log_test.go b/src/core/api/log_test.go similarity index 100% rename from src/ui/api/log_test.go rename to src/core/api/log_test.go diff --git a/src/ui/api/metadata.go b/src/core/api/metadata.go similarity index 99% rename from src/ui/api/metadata.go rename to src/core/api/metadata.go index d1242f612..2dc66233c 100644 --- a/src/ui/api/metadata.go +++ b/src/core/api/metadata.go @@ -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 ... diff --git a/src/ui/api/metadata_test.go b/src/core/api/metadata_test.go similarity index 100% rename from src/ui/api/metadata_test.go rename to src/core/api/metadata_test.go diff --git a/src/ui/api/models/reg_gc.go b/src/core/api/models/reg_gc.go similarity index 98% rename from src/ui/api/models/reg_gc.go rename to src/core/api/models/reg_gc.go index f50d3577f..e6f1ccbf1 100644 --- a/src/ui/api/models/reg_gc.go +++ b/src/core/api/models/reg_gc.go @@ -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 } diff --git a/src/ui/api/models/reg_gc_test.go b/src/core/api/models/reg_gc_test.go similarity index 98% rename from src/ui/api/models/reg_gc_test.go rename to src/core/api/models/reg_gc_test.go index 0eb6c2a5c..efa270f80 100644 --- a/src/ui/api/models/reg_gc_test.go +++ b/src/core/api/models/reg_gc_test.go @@ -25,7 +25,7 @@ import ( ) var adminServerTestConfig = map[string]interface{}{ - common.DefaultUIEndpoint: "test", + common.DefaultCoreEndpoint: "test", } func TestMain(m *testing.M) { diff --git a/src/ui/api/models/replication.go b/src/core/api/models/replication.go similarity index 100% rename from src/ui/api/models/replication.go rename to src/core/api/models/replication.go diff --git a/src/ui/api/models/replication_job.go b/src/core/api/models/replication_job.go similarity index 100% rename from src/ui/api/models/replication_job.go rename to src/core/api/models/replication_job.go diff --git a/src/ui/api/models/replication_policy.go b/src/core/api/models/replication_policy.go similarity index 100% rename from src/ui/api/models/replication_policy.go rename to src/core/api/models/replication_policy.go diff --git a/src/ui/api/project.go b/src/core/api/project.go similarity index 99% rename from src/ui/api/project.go rename to src/core/api/project.go index 646b46d43..4cb0d4a03 100644 --- a/src/ui/api/project.go +++ b/src/core/api/project.go @@ -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" diff --git a/src/ui/api/project_test.go b/src/core/api/project_test.go similarity index 100% rename from src/ui/api/project_test.go rename to src/core/api/project_test.go diff --git a/src/ui/api/projectmember.go b/src/core/api/projectmember.go similarity index 99% rename from src/ui/api/projectmember.go rename to src/core/api/projectmember.go index ac4705649..fe63f98e4 100644 --- a/src/ui/api/projectmember.go +++ b/src/core/api/projectmember.go @@ -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/{} diff --git a/src/ui/api/projectmember_test.go b/src/core/api/projectmember_test.go similarity index 100% rename from src/ui/api/projectmember_test.go rename to src/core/api/projectmember_test.go diff --git a/src/ui/api/reg_gc.go b/src/core/api/reg_gc.go similarity index 95% rename from src/ui/api/reg_gc.go rename to src/core/api/reg_gc.go index 4d323fb9a..69d734b77 100644 --- a/src/ui/api/reg_gc.go +++ b/src/core/api/reg_gc.go @@ -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) diff --git a/src/ui/api/reg_gc_test.go b/src/core/api/reg_gc_test.go similarity index 96% rename from src/ui/api/reg_gc_test.go rename to src/core/api/reg_gc_test.go index da3b51b54..5c7b7bbea 100644 --- a/src/ui/api/reg_gc_test.go +++ b/src/core/api/reg_gc_test.go @@ -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" ) diff --git a/src/ui/api/replication.go b/src/core/api/replication.go similarity index 97% rename from src/ui/api/replication.go rename to src/core/api/replication.go index 8c1fcec69..2b757f8ab 100644 --- a/src/ui/api/replication.go +++ b/src/core/api/replication.go @@ -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 diff --git a/src/ui/api/replication_job.go b/src/core/api/replication_job.go similarity index 98% rename from src/ui/api/replication_job.go rename to src/core/api/replication_job.go index 54ffe8ee4..a166b49a7 100644 --- a/src/ui/api/replication_job.go +++ b/src/core/api/replication_job.go @@ -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 diff --git a/src/ui/api/replication_policy.go b/src/core/api/replication_policy.go similarity index 99% rename from src/ui/api/replication_policy.go rename to src/core/api/replication_policy.go index 42c58844b..cd11f0da1 100644 --- a/src/ui/api/replication_policy.go +++ b/src/core/api/replication_policy.go @@ -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 diff --git a/src/ui/api/replication_policy_test.go b/src/core/api/replication_policy_test.go similarity index 99% rename from src/ui/api/replication_policy_test.go rename to src/core/api/replication_policy_test.go index acba12a6b..ff95f0da7 100644 --- a/src/ui/api/replication_policy_test.go +++ b/src/core/api/replication_policy_test.go @@ -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" ) diff --git a/src/ui/api/replication_test.go b/src/core/api/replication_test.go similarity index 97% rename from src/ui/api/replication_test.go rename to src/core/api/replication_test.go index 991463360..7e8de8ee8 100644 --- a/src/ui/api/replication_test.go +++ b/src/core/api/replication_test.go @@ -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" ) diff --git a/src/ui/api/repository.go b/src/core/api/repository.go similarity index 97% rename from src/ui/api/repository.go rename to src/core/api/repository.go index 0634abaab..d42255a01 100644 --- a/src/ui/api/repository.go +++ b/src/core/api/repository.go @@ -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) } diff --git a/src/ui/api/repository_label.go b/src/core/api/repository_label.go similarity index 97% rename from src/ui/api/repository_label.go rename to src/core/api/repository_label.go index 6a241a255..f55e31737 100644 --- a/src/ui/api/repository_label.go +++ b/src/core/api/repository_label.go @@ -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 } diff --git a/src/ui/api/repository_label_test.go b/src/core/api/repository_label_test.go similarity index 100% rename from src/ui/api/repository_label_test.go rename to src/core/api/repository_label_test.go diff --git a/src/ui/api/repository_test.go b/src/core/api/repository_test.go similarity index 100% rename from src/ui/api/repository_test.go rename to src/core/api/repository_test.go diff --git a/src/ui/api/scan_job.go b/src/core/api/scan_job.go similarity index 98% rename from src/ui/api/scan_job.go rename to src/core/api/scan_job.go index 5fbbf87ac..ad5e20e36 100644 --- a/src/ui/api/scan_job.go +++ b/src/core/api/scan_job.go @@ -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" diff --git a/src/ui/api/search.go b/src/core/api/search.go similarity index 97% rename from src/ui/api/search.go rename to src/core/api/search.go index 957165be3..8e02832af 100644 --- a/src/ui/api/search.go +++ b/src/core/api/search.go @@ -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 } diff --git a/src/ui/api/search_test.go b/src/core/api/search_test.go similarity index 100% rename from src/ui/api/search_test.go rename to src/core/api/search_test.go diff --git a/src/ui/api/statistic.go b/src/core/api/statistic.go similarity index 100% rename from src/ui/api/statistic.go rename to src/core/api/statistic.go diff --git a/src/ui/api/statistic_test.go b/src/core/api/statistic_test.go similarity index 100% rename from src/ui/api/statistic_test.go rename to src/core/api/statistic_test.go diff --git a/src/ui/api/systeminfo.go b/src/core/api/systeminfo.go similarity index 98% rename from src/ui/api/systeminfo.go rename to src/core/api/systeminfo.go index 6678512f3..beaf8c3ff 100644 --- a/src/ui/api/systeminfo.go +++ b/src/core/api/systeminfo.go @@ -28,7 +28,7 @@ import ( "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/clair" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/ui/config" + "github.com/goharbor/harbor/src/core/config" ) // SystemInfoAPI handle requests for getting system info /api/systeminfo @@ -36,7 +36,7 @@ type SystemInfoAPI struct { BaseController } -const defaultRootCert = "/etc/ui/ca/ca.crt" +const defaultRootCert = "/etc/core/ca/ca.crt" const harborVersionFile = "/harbor/UIVERSION" // SystemInfo models for system info. @@ -252,7 +252,7 @@ func getClairVulnStatus() *models.ClairVulnerabilityStatus { return res } -// Ping ping the harbor UI service. +// Ping ping the harbor core service. func (sia *SystemInfoAPI) Ping() { sia.Data["json"] = "Pong" sia.ServeJSON() diff --git a/src/ui/api/systeminfo_test.go b/src/core/api/systeminfo_test.go similarity index 100% rename from src/ui/api/systeminfo_test.go rename to src/core/api/systeminfo_test.go diff --git a/src/ui/api/target.go b/src/core/api/target.go similarity index 99% rename from src/ui/api/target.go rename to src/core/api/target.go index fec136080..4f31c0497 100644 --- a/src/ui/api/target.go +++ b/src/core/api/target.go @@ -25,7 +25,7 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/common/utils/registry" "github.com/goharbor/harbor/src/common/utils/registry/auth" - "github.com/goharbor/harbor/src/ui/config" + "github.com/goharbor/harbor/src/core/config" ) // TargetAPI handles request to /api/targets/ping /api/targets/{} diff --git a/src/ui/api/target_test.go b/src/core/api/target_test.go similarity index 100% rename from src/ui/api/target_test.go rename to src/core/api/target_test.go diff --git a/src/ui/api/user.go b/src/core/api/user.go similarity index 99% rename from src/ui/api/user.go rename to src/core/api/user.go index 485fa950a..df0e4b45d 100644 --- a/src/ui/api/user.go +++ b/src/core/api/user.go @@ -26,7 +26,7 @@ import ( "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/ui/config" + "github.com/goharbor/harbor/src/core/config" ) // UserAPI handles request to /api/users/{} diff --git a/src/ui/api/user_test.go b/src/core/api/user_test.go similarity index 100% rename from src/ui/api/user_test.go rename to src/core/api/user_test.go diff --git a/src/ui/api/usergroup.go b/src/core/api/usergroup.go similarity index 99% rename from src/ui/api/usergroup.go rename to src/core/api/usergroup.go index d924bf7a6..49d997063 100644 --- a/src/ui/api/usergroup.go +++ b/src/core/api/usergroup.go @@ -25,7 +25,7 @@ import ( "github.com/goharbor/harbor/src/common/models" "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" ) // UserGroupAPI ... diff --git a/src/ui/api/usergroup_test.go b/src/core/api/usergroup_test.go similarity index 100% rename from src/ui/api/usergroup_test.go rename to src/core/api/usergroup_test.go diff --git a/src/ui/api/utils.go b/src/core/api/utils.go similarity index 93% rename from src/ui/api/utils.go rename to src/core/api/utils.go index a740bdb47..6d11dd1f0 100644 --- a/src/ui/api/utils.go +++ b/src/core/api/utils.go @@ -29,10 +29,10 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/common/utils/registry" "github.com/goharbor/harbor/src/common/utils/registry/auth" - "github.com/goharbor/harbor/src/ui/config" - "github.com/goharbor/harbor/src/ui/promgr" - "github.com/goharbor/harbor/src/ui/service/token" - uiutils "github.com/goharbor/harbor/src/ui/utils" + "github.com/goharbor/harbor/src/core/config" + "github.com/goharbor/harbor/src/core/promgr" + "github.com/goharbor/harbor/src/core/service/token" + coreutils "github.com/goharbor/harbor/src/core/utils" ) // SyncRegistry syncs the repositories of registry with database. @@ -150,7 +150,7 @@ func diffRepos(reposInRegistry []string, reposInDB []string, } // TODO remove the workaround when the bug of registry is fixed - client, err := uiutils.NewRepositoryClientForUI("harbor-ui", repoInR) + client, err := coreutils.NewRepositoryClientForUI("harbor-core", repoInR) if err != nil { return needsAdd, needsDel, err } @@ -170,7 +170,7 @@ func diffRepos(reposInRegistry []string, reposInDB []string, j++ } else { // TODO remove the workaround when the bug of registry is fixed - client, err := uiutils.NewRepositoryClientForUI("harbor-ui", repoInR) + client, err := coreutils.NewRepositoryClientForUI("harbor-core", repoInR) if err != nil { return needsAdd, needsDel, err } @@ -202,7 +202,7 @@ func diffRepos(reposInRegistry []string, reposInDB []string, continue } - client, err := uiutils.NewRepositoryClientForUI("harbor-ui", repoInR) + client, err := coreutils.NewRepositoryClientForUI("harbor-core", repoInR) if err != nil { log.Errorf("failed to create repository client: %v", err) continue @@ -249,7 +249,7 @@ func initRegistryClient() (r *registry.Registry, err error) { return nil, err } - authorizer := auth.NewRawTokenAuthorizer("harbor-ui", token.Registry) + authorizer := auth.NewRawTokenAuthorizer("harbor-core", token.Registry) return registry.NewRegistry(endpoint, &http.Client{ Transport: registry.NewTransport(registry.GetHTTPTransport(), authorizer), }) diff --git a/src/ui/auth/auth_test.go b/src/core/auth/auth_test.go similarity index 100% rename from src/ui/auth/auth_test.go rename to src/core/auth/auth_test.go diff --git a/src/ui/auth/authenticator.go b/src/core/auth/authenticator.go similarity index 99% rename from src/ui/auth/authenticator.go rename to src/core/auth/authenticator.go index 9d44958a5..4b17264b6 100644 --- a/src/ui/auth/authenticator.go +++ b/src/core/auth/authenticator.go @@ -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" ) // 1.5 seconds diff --git a/src/ui/auth/db/db.go b/src/core/auth/db/db.go similarity index 97% rename from src/ui/auth/db/db.go rename to src/core/auth/db/db.go index e7ecb6c8f..80aa2a145 100644 --- a/src/ui/auth/db/db.go +++ b/src/core/auth/db/db.go @@ -17,7 +17,7 @@ package db import ( "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" - "github.com/goharbor/harbor/src/ui/auth" + "github.com/goharbor/harbor/src/core/auth" ) // Auth implements Authenticator interface to authenticate user against DB. diff --git a/src/ui/auth/db/db_test.go b/src/core/auth/db/db_test.go similarity index 96% rename from src/ui/auth/db/db_test.go rename to src/core/auth/db/db_test.go index ecee9e303..862dbfc08 100644 --- a/src/ui/auth/db/db_test.go +++ b/src/core/auth/db/db_test.go @@ -24,8 +24,8 @@ import ( "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/ldap" - "github.com/goharbor/harbor/src/ui/auth" - uiConfig "github.com/goharbor/harbor/src/ui/config" + "github.com/goharbor/harbor/src/core/auth" + coreConfig "github.com/goharbor/harbor/src/core/config" ) var adminServerTestConfig = map[string]interface{}{ @@ -87,11 +87,11 @@ func TestMain(m *testing.M) { log.Fatalf("failed to set env %s: %v", "KEY_PATH", err) } - if err := uiConfig.Init(); err != nil { + if err := coreConfig.Init(); err != nil { log.Fatalf("failed to initialize configurations: %v", err) } - database, err := uiConfig.Database() + database, err := coreConfig.Database() if err != nil { log.Fatalf("failed to get database configuration: %v", err) } diff --git a/src/ui/auth/ldap/ldap.go b/src/core/auth/ldap/ldap.go similarity index 98% rename from src/ui/auth/ldap/ldap.go rename to src/core/auth/ldap/ldap.go index 47ce5b5dd..884ad8c9d 100644 --- a/src/ui/auth/ldap/ldap.go +++ b/src/core/auth/ldap/ldap.go @@ -28,8 +28,8 @@ 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/ui/config" + "github.com/goharbor/harbor/src/core/auth" + "github.com/goharbor/harbor/src/core/config" ) // Auth implements AuthenticateHelper interface to authenticate against LDAP diff --git a/src/ui/auth/ldap/ldap_test.go b/src/core/auth/ldap/ldap_test.go similarity index 98% rename from src/ui/auth/ldap/ldap_test.go rename to src/core/auth/ldap/ldap_test.go index 33026ff4a..67a3b4213 100644 --- a/src/ui/auth/ldap/ldap_test.go +++ b/src/core/auth/ldap/ldap_test.go @@ -26,10 +26,10 @@ import ( "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/common/utils/test" - "github.com/goharbor/harbor/src/ui/api" + "github.com/goharbor/harbor/src/core/api" - "github.com/goharbor/harbor/src/ui/auth" - uiConfig "github.com/goharbor/harbor/src/ui/config" + "github.com/goharbor/harbor/src/core/auth" + coreConfig "github.com/goharbor/harbor/src/core/config" ) var adminServerLdapTestConfig = map[string]interface{}{ @@ -96,11 +96,11 @@ func TestMain(m *testing.M) { log.Fatalf("failed to set env %s: %v", "KEY_PATH", err) } - if err := uiConfig.Init(); err != nil { + if err := coreConfig.Init(); err != nil { log.Fatalf("failed to initialize configurations: %v", err) } - database, err := uiConfig.Database() + database, err := coreConfig.Database() if err != nil { log.Fatalf("failed to get database configuration: %v", err) } diff --git a/src/ui/auth/lock.go b/src/core/auth/lock.go similarity index 100% rename from src/ui/auth/lock.go rename to src/core/auth/lock.go diff --git a/src/ui/auth/uaa/uaa.go b/src/core/auth/uaa/uaa.go similarity index 97% rename from src/ui/auth/uaa/uaa.go rename to src/core/auth/uaa/uaa.go index 5ce771cab..bfad347a5 100644 --- a/src/ui/auth/uaa/uaa.go +++ b/src/core/auth/uaa/uaa.go @@ -25,8 +25,8 @@ import ( "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/common/utils/uaa" - "github.com/goharbor/harbor/src/ui/auth" - "github.com/goharbor/harbor/src/ui/config" + "github.com/goharbor/harbor/src/core/auth" + "github.com/goharbor/harbor/src/core/config" ) // Auth is the implementation of AuthenticateHelper to access uaa for authentication. diff --git a/src/ui/auth/uaa/uaa_test.go b/src/core/auth/uaa/uaa_test.go similarity index 98% rename from src/ui/auth/uaa/uaa_test.go rename to src/core/auth/uaa/uaa_test.go index a2988333a..f587acc5e 100644 --- a/src/ui/auth/uaa/uaa_test.go +++ b/src/core/auth/uaa/uaa_test.go @@ -23,7 +23,7 @@ import ( "github.com/goharbor/harbor/src/common/utils/test" utilstest "github.com/goharbor/harbor/src/common/utils/test" "github.com/goharbor/harbor/src/common/utils/uaa" - "github.com/goharbor/harbor/src/ui/config" + "github.com/goharbor/harbor/src/core/config" "github.com/stretchr/testify/assert" ) diff --git a/src/ui/config/config.go b/src/core/config/config.go similarity index 94% rename from src/ui/config/config.go rename to src/core/config/config.go index cf6c2d32b..ae85136b0 100644 --- a/src/ui/config/config.go +++ b/src/core/config/config.go @@ -33,16 +33,16 @@ import ( "github.com/goharbor/harbor/src/common/secret" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/ui/promgr" - "github.com/goharbor/harbor/src/ui/promgr/pmsdriver" - "github.com/goharbor/harbor/src/ui/promgr/pmsdriver/admiral" - "github.com/goharbor/harbor/src/ui/promgr/pmsdriver/local" + "github.com/goharbor/harbor/src/core/promgr" + "github.com/goharbor/harbor/src/core/promgr/pmsdriver" + "github.com/goharbor/harbor/src/core/promgr/pmsdriver/admiral" + "github.com/goharbor/harbor/src/core/promgr/pmsdriver/local" ) const ( - defaultKeyPath = "/etc/ui/key" - defaultTokenFilePath = "/etc/ui/token/tokens.properties" - defaultRegistryTokenPrivateKeyPath = "/etc/ui/private_key.pem" + defaultKeyPath = "/etc/core/key" + defaultTokenFilePath = "/etc/core/token/tokens.properties" + defaultRegistryTokenPrivateKeyPath = "/etc/core/private_key.pem" ) var ( @@ -60,7 +60,7 @@ var ( // TokenReader is used in integration mode to read token TokenReader admiral.TokenReader // defined as a var for testing. - defaultCACertPath = "/etc/ui/ca/ca.crt" + defaultCACertPath = "/etc/core/ca/ca.crt" ) // Init configurations @@ -80,7 +80,7 @@ func Init() error { func InitByURL(adminServerURL string) error { log.Infof("initializing client for adminserver %s ...", adminServerURL) cfg := &client.Config{ - Secret: UISecret(), + Secret: CoreSecret(), } AdminserverClient = client.NewClient(adminServerURL, cfg) if err := AdminserverClient.Ping(); err != nil { @@ -326,20 +326,20 @@ func InternalJobServiceURL() string { return strings.TrimSuffix(utils.SafeCastString(cfg[common.JobServiceURL]), "/") } -// InternalUIURL returns the local ui url -func InternalUIURL() string { +// InternalCoreURL returns the local harbor core url +func InternalCoreURL() string { cfg, err := mg.Get() if err != nil { - log.Warningf("Failed to Get job service UI URL from backend, error: %v, will return default value.") - return common.DefaultUIEndpoint + log.Warningf("Failed to Get job service Core URL from backend, error: %v, will return default value.") + return common.DefaultCoreEndpoint } - return strings.TrimSuffix(utils.SafeCastString(cfg[common.UIURL]), "/") + return strings.TrimSuffix(utils.SafeCastString(cfg[common.CoreURL]), "/") } // InternalTokenServiceEndpoint returns token service endpoint for internal communication between Harbor containers func InternalTokenServiceEndpoint() string { - return InternalUIURL() + "/service/token" + return InternalCoreURL() + "/service/token" } // InternalNotaryEndpoint returns notary server endpoint for internal communication between Harbor containers @@ -416,10 +416,10 @@ func Database() (*models.Database, error) { return database, nil } -// UISecret returns a secret to mark UI when communicate with +// CoreSecret returns a secret to mark harbor-core when communicate with // other component -func UISecret() string { - return os.Getenv("UI_SECRET") +func CoreSecret() string { + return os.Getenv("CORE_SECRET") } // JobserviceSecret returns a secret to mark Jobservice when communicate with diff --git a/src/ui/config/config_test.go b/src/core/config/config_test.go similarity index 98% rename from src/ui/config/config_test.go rename to src/core/config/config_test.go index 42bc16cbf..66d78d860 100644 --- a/src/ui/config/config_test.go +++ b/src/core/config/config_test.go @@ -24,7 +24,7 @@ import ( "github.com/stretchr/testify/assert" ) -// test functions under package ui/config +// test functions under package core/config func TestConfig(t *testing.T) { defaultCACertPath = path.Join(currPath(), "test", "ca.crt") @@ -185,8 +185,8 @@ func TestConfig(t *testing.T) { t.Errorf("unexpected scan all policy %v", s) } - if tokenKeyPath := TokenPrivateKeyPath(); tokenKeyPath != "/etc/ui/private_key.pem" { - t.Errorf("Unexpected token private key path: %s, expected: %s", tokenKeyPath, "/etc/ui/private_key.pem") + if tokenKeyPath := TokenPrivateKeyPath(); tokenKeyPath != "/etc/core/private_key.pem" { + t.Errorf("Unexpected token private key path: %s, expected: %s", tokenKeyPath, "/etc/core/private_key.pem") } us, err := UAASettings() diff --git a/src/ui/config/test/ca.crt b/src/core/config/test/ca.crt similarity index 100% rename from src/ui/config/test/ca.crt rename to src/core/config/test/ca.crt diff --git a/src/ui/controllers/base.go b/src/core/controllers/base.go similarity index 98% rename from src/ui/controllers/base.go rename to src/core/controllers/base.go index 74f9af6b8..9b13cd575 100644 --- a/src/ui/controllers/base.go +++ b/src/core/controllers/base.go @@ -31,8 +31,8 @@ import ( "github.com/goharbor/harbor/src/common/utils" email_util "github.com/goharbor/harbor/src/common/utils/email" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/ui/auth" - "github.com/goharbor/harbor/src/ui/config" + "github.com/goharbor/harbor/src/core/auth" + "github.com/goharbor/harbor/src/core/config" ) // CommonController handles request from UI that doesn't expect a page, such as /SwitchLanguage /logout ... diff --git a/src/ui/controllers/controllers_test.go b/src/core/controllers/controllers_test.go similarity index 91% rename from src/ui/controllers/controllers_test.go rename to src/core/controllers/controllers_test.go index 517f0ab53..b845afe7b 100644 --- a/src/ui/controllers/controllers_test.go +++ b/src/core/controllers/controllers_test.go @@ -30,8 +30,8 @@ import ( "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/test" - "github.com/goharbor/harbor/src/ui/config" - "github.com/goharbor/harbor/src/ui/proxy" + "github.com/goharbor/harbor/src/core/config" + "github.com/goharbor/harbor/src/core/proxy" "github.com/stretchr/testify/assert" ) @@ -143,15 +143,9 @@ func TestAll(t *testing.T) { // v.Set("principal", "admin") // v.Add("password", "Harbor12345") - r, _ := http.NewRequest("GET", "/", nil) + r, _ := http.NewRequest("POST", "/login", nil) w := httptest.NewRecorder() beego.BeeApp.Handlers.ServeHTTP(w, r) - assert.Equal(int(200), w.Code, "'/' httpStatusCode should be 200") - assert.Equal(true, strings.Contains(fmt.Sprintf("%s", w.Body), "