mirror of https://github.com/kubernetes/kops.git
Merge pull request #17453 from hakman/hetzner-object-storage
hetzner: Add support for Object Storage
This commit is contained in:
commit
89dcfb1718
|
@ -50,6 +50,8 @@ func GuessCloudForPath(path string) (kops.CloudProviderID, error) {
|
||||||
return kops.CloudProviderAzure, nil
|
return kops.CloudProviderAzure, nil
|
||||||
case strings.HasPrefix(path, "do://"):
|
case strings.HasPrefix(path, "do://"):
|
||||||
return kops.CloudProviderDO, nil
|
return kops.CloudProviderDO, nil
|
||||||
|
case strings.HasPrefix(path, "hos://"):
|
||||||
|
return kops.CloudProviderHetzner, nil
|
||||||
case strings.HasPrefix(path, "gs://"):
|
case strings.HasPrefix(path, "gs://"):
|
||||||
return kops.CloudProviderGCE, nil
|
return kops.CloudProviderGCE, nil
|
||||||
case strings.HasPrefix(path, "scw://"):
|
case strings.HasPrefix(path, "scw://"):
|
||||||
|
|
|
@ -185,6 +185,10 @@ func (c *VFSContext) BuildVfsPath(p string) (Path, error) {
|
||||||
return c.buildDOPath(p)
|
return c.buildDOPath(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(p, "hos://") {
|
||||||
|
return c.buildHetznerPath(p)
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(p, "memfs://") {
|
if strings.HasPrefix(p, "memfs://") {
|
||||||
return c.buildMemFSPath(p)
|
return c.buildMemFSPath(p)
|
||||||
}
|
}
|
||||||
|
@ -356,6 +360,24 @@ func (c *VFSContext) buildDOPath(p string) (*S3Path, error) {
|
||||||
return s3path, nil
|
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) {
|
func (c *VFSContext) buildKubernetesPath(p string) (*KubernetesPath, error) {
|
||||||
u, err := url.Parse(p)
|
u, err := url.Parse(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue