0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00
zot/pkg/extensions/get_extensions.go
Andreea Lupu 5a3fac40db
feat: upload cosign public key and notation certificates to cloud (#1744)
- using secrets manager for storing public keys and certificates
- adding a default truststore for notation verification and upload all certificates to this default truststore
- removig `truststoreName` query param from notation api for uploading certificates


(cherry picked from commit eafcc1a213)

Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
2023-09-08 10:03:58 +03:00

61 lines
1.8 KiB
Go

package extensions
import (
distext "github.com/opencontainers/distribution-spec/specs-go/v1/extensions"
"zotregistry.io/zot/pkg/api/config"
"zotregistry.io/zot/pkg/api/constants"
"zotregistry.io/zot/pkg/log"
mTypes "zotregistry.io/zot/pkg/meta/types"
"zotregistry.io/zot/pkg/scheduler"
)
func GetExtensions(config *config.Config) distext.ExtensionList {
extensionList := distext.ExtensionList{}
endpoints := []string{}
extensions := []distext.Extension{}
if config.IsNotationEnabled() && IsBuiltWithImageTrustExtension() {
endpoints = append(endpoints, constants.FullNotation)
}
if config.IsCosignEnabled() && IsBuiltWithImageTrustExtension() {
endpoints = append(endpoints, constants.FullCosign)
}
if config.IsSearchEnabled() && IsBuiltWithSearchExtension() {
endpoints = append(endpoints, constants.FullSearchPrefix)
}
if config.AreUserPrefsEnabled() && IsBuiltWithUserPrefsExtension() {
endpoints = append(endpoints, constants.FullUserPrefs)
}
if config.IsMgmtEnabled() && IsBuiltWithMGMTExtension() {
endpoints = append(endpoints, constants.FullMgmt)
}
if len(endpoints) > 0 {
extensions = append(extensions, distext.Extension{
Name: constants.BaseExtension,
URL: "https://github.com/project-zot/zot/blob/" + config.ReleaseTag + "/pkg/extensions/_zot.md",
Description: "zot registry extensions",
Endpoints: endpoints,
})
}
extensionList.Extensions = extensions
return extensionList
}
func EnableScheduledTasks(conf *config.Config, taskScheduler *scheduler.Scheduler,
metaDB mTypes.MetaDB, log log.Logger,
) {
EnableImageTrustVerification(conf, taskScheduler, metaDB, log)
}
func SetupExtensions(conf *config.Config, metaDB mTypes.MetaDB, log log.Logger) error {
return SetupImageTrustExtension(conf, metaDB, log)
}