softplayer-backend/internal/providers/kubernetes/common.go

22 lines
419 B
Go
Raw Normal View History

2024-04-29 18:03:37 +00:00
package kubernetes
import (
"fmt"
proto "git.badhouseplants.net/softplayer/softplayer-go-proto/pkg/environments"
)
type Kubernetes interface {
GetKubernetesName() string
RawKubernetesName() string
}
2024-04-30 07:47:00 +00:00
func GetKubernetes(k8s string) (Kubernetes, error) {
2024-04-29 18:03:37 +00:00
switch k8s {
2024-04-30 07:47:00 +00:00
case proto.Kubernetes_KUBERNETES_K3S.String(), "k3s":
2024-04-29 18:03:37 +00:00
return &K3s{}, nil
default:
2024-04-30 07:47:00 +00:00
return nil, fmt.Errorf("unknown provider: %s", k8s)
2024-04-29 18:03:37 +00:00
}
}