A small refactoring
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
package providers
 | 
			
		||||
package infra
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package providers
 | 
			
		||||
package infra
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
							
								
								
									
										21
									
								
								internal/providers/kubernetes/common.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								internal/providers/kubernetes/common.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
package kubernetes
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	proto "git.badhouseplants.net/softplayer/softplayer-go-proto/pkg/environments"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Kubernetes interface {
 | 
			
		||||
	GetKubernetesName() string
 | 
			
		||||
	RawKubernetesName() string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func GetKubernetes(k8s string) (Kubernetes, error) {
 | 
			
		||||
	switch k8s {
 | 
			
		||||
	case proto.Kubernetes_KUBERNETES_K3S.String(), "k3s":
 | 
			
		||||
		return &K3s{}, nil
 | 
			
		||||
	default:
 | 
			
		||||
		return nil, fmt.Errorf("unknown provider: %s", k8s)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								internal/providers/kubernetes/k3s.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								internal/providers/kubernetes/k3s.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
package kubernetes
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	proto "git.badhouseplants.net/softplayer/softplayer-go-proto/pkg/environments"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type K3s struct{}
 | 
			
		||||
 | 
			
		||||
func (k *K3s) GetKubernetesName() string {
 | 
			
		||||
	return "k3s"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (k *K3s) RawKubernetesName() string {
 | 
			
		||||
	return proto.Kubernetes_KUBERNETES_K3S.String()
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user