Merge pull request #4036 from ywk253100/180116_s3

Propagate registry storage driver name to adminserver and return it in /api/systeminfo
This commit is contained in:
Wenkai Yin 2018-01-16 18:41:08 +08:00 committed by GitHub
commit 8cda2d8d65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 89 additions and 81 deletions

View File

@ -51,3 +51,4 @@ UAA_CLIENTSECRET=$uaa_clientsecret
UAA_VERIFY_CERT=$uaa_verify_cert UAA_VERIFY_CERT=$uaa_verify_cert
UI_URL=http://ui:8080 UI_URL=http://ui:8080
JOBSERVICE_URL=http://jobservice:8080 JOBSERVICE_URL=http://jobservice:8080
REGISTRY_STORAGE_PROVIDER_NAME=$storage_provider_name

View File

@ -262,6 +262,9 @@ if rcp.has_option("configuration", "redis_url"):
else: else:
redis_url = "" redis_url = ""
storage_provider_name = rcp.get("configuration", "registry_storage_provider_name").strip()
storage_provider_config = rcp.get("configuration", "registry_storage_provider_config").strip()
ui_secret = ''.join(random.choice(string.ascii_letters+string.digits) for i in range(16)) ui_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)) jobservice_secret = ''.join(random.choice(string.ascii_letters+string.digits) for i in range(16))
@ -349,7 +352,8 @@ render(os.path.join(templates_dir, "adminserver", "env"),
uaa_endpoint=uaa_endpoint, uaa_endpoint=uaa_endpoint,
uaa_clientid=uaa_clientid, uaa_clientid=uaa_clientid,
uaa_clientsecret=uaa_clientsecret, uaa_clientsecret=uaa_clientsecret,
uaa_verify_cert=uaa_verify_cert uaa_verify_cert=uaa_verify_cert,
storage_provider_name=storage_provider_name
) )
render(os.path.join(templates_dir, "ui", "env"), render(os.path.join(templates_dir, "ui", "env"),
@ -360,8 +364,6 @@ render(os.path.join(templates_dir, "ui", "env"),
) )
registry_config_file = "config_ha.yml" if args.ha_mode else "config.yml" registry_config_file = "config_ha.yml" if args.ha_mode else "config.yml"
storage_provider_name = rcp.get("configuration", "registry_storage_provider_name").strip()
storage_provider_config = rcp.get("configuration", "registry_storage_provider_config").strip()
if storage_provider_name == "filesystem": if storage_provider_name == "filesystem":
if not storage_provider_config: if not storage_provider_config:
storage_provider_config = "rootdirectory: /storage" storage_provider_config = "rootdirectory: /storage"

View File

@ -143,6 +143,7 @@ var (
}, },
common.UIURL: "UI_URL", common.UIURL: "UI_URL",
common.JobServiceURL: "JOBSERVICE_URL", common.JobServiceURL: "JOBSERVICE_URL",
common.RegistryStorageProviderName: "REGISTRY_STORAGE_PROVIDER_NAME",
} }
// configurations need read from environment variables // configurations need read from environment variables
@ -175,6 +176,7 @@ var (
env: "UAA_VERIFY_CERT", env: "UAA_VERIFY_CERT",
parse: parseStringToBool, parse: parseStringToBool,
}, },
common.RegistryStorageProviderName: "REGISTRY_STORAGE_PROVIDER_NAME",
} }
) )

View File

@ -83,4 +83,5 @@ const (
CfgDriverDB = "db" CfgDriverDB = "db"
CfgDriverJSON = "json" CfgDriverJSON = "json"
NewHarborAdminName = "admin@harbor.local" NewHarborAdminName = "admin@harbor.local"
RegistryStorageProviderName = "registry_storage_provider_name"
) )

View File

@ -98,6 +98,7 @@ type GeneralInfo struct {
HarborVersion string `json:"harbor_version"` HarborVersion string `json:"harbor_version"`
NextScanAll int64 `json:"next_scan_all"` NextScanAll int64 `json:"next_scan_all"`
ClairVulnStatus *models.ClairVulnerabilityStatus `json:"clair_vulnerability_status,omitempty"` ClairVulnStatus *models.ClairVulnerabilityStatus `json:"clair_vulnerability_status,omitempty"`
RegistryStorageProviderName string `json:"registry_storage_provider_name"`
} }
// validate for validating user if an admin. // validate for validating user if an admin.
@ -175,6 +176,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
RegistryURL: registryURL, RegistryURL: registryURL,
HasCARoot: caStatErr == nil, HasCARoot: caStatErr == nil,
HarborVersion: harborVersion, HarborVersion: harborVersion,
RegistryStorageProviderName: cfg[common.RegistryStorageProviderName].(string),
} }
if info.WithClair { if info.WithClair {
info.ClairVulnStatus = getClairVulnStatus() info.ClairVulnStatus = getClairVulnStatus()