Merge pull request #17453 from hakman/hetzner-object-storage

hetzner: Add support for Object Storage
This commit is contained in:
Kubernetes Prow Robot 2025-06-22 06:44:53 -07:00 committed by GitHub
commit 89dcfb1718
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View File

@ -50,6 +50,8 @@ func GuessCloudForPath(path string) (kops.CloudProviderID, error) {
return kops.CloudProviderAzure, nil
case strings.HasPrefix(path, "do://"):
return kops.CloudProviderDO, nil
case strings.HasPrefix(path, "hos://"):
return kops.CloudProviderHetzner, nil
case strings.HasPrefix(path, "gs://"):
return kops.CloudProviderGCE, nil
case strings.HasPrefix(path, "scw://"):

View File

@ -185,6 +185,10 @@ func (c *VFSContext) BuildVfsPath(p string) (Path, error) {
return c.buildDOPath(p)
}
if strings.HasPrefix(p, "hos://") {
return c.buildHetznerPath(p)
}
if strings.HasPrefix(p, "memfs://") {
return c.buildMemFSPath(p)
}
@ -356,6 +360,24 @@ func (c *VFSContext) buildDOPath(p string) (*S3Path, error) {
return s3path, nil
}
func (c *VFSContext) buildHetznerPath(p string) (*S3Path, error) {
u, err := url.Parse(p)
if err != nil {
return nil, fmt.Errorf("invalid Hetzner Object Storage path: %q", p)
}
if u.Scheme != "hos" {
return nil, fmt.Errorf("invalid Hetzner object storage path: %q", p)
}
bucket := strings.TrimSuffix(u.Host, "/")
if bucket == "" {
return nil, fmt.Errorf("invalid Hetzner object storage path: %q", p)
}
s3path := newS3Path(c.s3Context, u.Scheme, bucket, u.Path, false)
return s3path, nil
}
func (c *VFSContext) buildKubernetesPath(p string) (*KubernetesPath, error) {
u, err := url.Parse(p)
if err != nil {