mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 05:19:39 +02:00
feat(oci): oci helm support [r8s-361] (#787)
This commit is contained in:
parent
b6a6ce9aaf
commit
2697d6c5d7
80 changed files with 4264 additions and 812 deletions
38
pkg/libhelm/options/chart_reference.go
Normal file
38
pkg/libhelm/options/chart_reference.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package options
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
// OCIProtocolPrefix is the standard OCI protocol prefix
|
||||
OCIProtocolPrefix = "oci://"
|
||||
)
|
||||
|
||||
// ConstructChartReference constructs the appropriate chart reference based on registry type
|
||||
func ConstructChartReference(registryURL string, chartName string) string {
|
||||
if registryURL == "" {
|
||||
return chartName
|
||||
}
|
||||
|
||||
// Don't double-prefix if chart already contains the registry URL
|
||||
if strings.HasPrefix(chartName, OCIProtocolPrefix) {
|
||||
return chartName
|
||||
}
|
||||
|
||||
baseURL := ConstructOCIRegistryReference(registryURL)
|
||||
|
||||
// Handle cases where chartName might already have a path separator
|
||||
if strings.HasPrefix(chartName, "/") {
|
||||
return baseURL + chartName
|
||||
}
|
||||
|
||||
return baseURL + "/" + chartName
|
||||
}
|
||||
|
||||
func ConstructOCIRegistryReference(registryURL string) string {
|
||||
// Remove oci:// prefix if present to avoid duplication
|
||||
registryURL = strings.TrimPrefix(registryURL, OCIProtocolPrefix)
|
||||
// Ensure we have oci:// prefix for OCI registries
|
||||
return OCIProtocolPrefix + registryURL
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue