Files
kubesphere/pkg/simple/client/oci/url.go
凌波 9b2c123bbb feat: Adapt to oci-based helmchart repo (#6200)
* add oci client for registry

* add LoadRepoIndexFormOci

* feat: Adapt to oci-based helmchart repo

* Update the golang base image version in the dockerfile

* update oci_test.go

Signed-off-by: lingbo <lingbo@lingbohome.com>

* fix: Update oci_test.go

Signed-off-by: 凌波 <lingbo@lingbohome.com>

* Update go imports

---------

Signed-off-by: lingbo <lingbo@lingbohome.com>
Signed-off-by: 凌波 <lingbo@lingbohome.com>
Co-authored-by: hongming <coder.scala@gmail.com>
2024-09-25 09:51:16 +08:00

23 lines
471 B
Go

package oci
import (
"fmt"
"oras.land/oras-go/pkg/registry"
)
func buildScheme(plainHTTP bool) string {
if plainHTTP {
return "http"
}
return "https"
}
func buildRegistryBaseURL(plainHTTP bool, ref registry.Reference) string {
return fmt.Sprintf("%s://%s/v2/", buildScheme(plainHTTP), ref.Host())
}
func buildRegistryCatalogURL(plainHTTP bool, ref registry.Reference) string {
return fmt.Sprintf("%s://%s/v2/_catalog", buildScheme(plainHTTP), ref.Host())
}