-
Notifications
You must be signed in to change notification settings - Fork 51
/
config.go
39 lines (33 loc) · 1.26 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package config
//go:generate go get github.com/golang/mock/mockgen
//go:generate mockgen -destination=../util/mocks/mock_$GOPACKAGE/config.go -package=mock_$GOPACKAGE -source config.go
//go:generate gofmt -s -l -w ../util/mocks/mock_$GOPACKAGE/config.go
//go:generate go get golang.org/x/tools/cmd/goimports
//go:generate goimports -local=github.com/openshift/openshift-azure -e -w ../util/mocks/mock_$GOPACKAGE/config.go
import (
"fmt"
"github.com/openshift/openshift-azure/pkg/api"
pluginapi "github.com/openshift/openshift-azure/pkg/api/plugin"
v10 "github.com/openshift/openshift-azure/pkg/config/v10"
v7 "github.com/openshift/openshift-azure/pkg/config/v7"
v71 "github.com/openshift/openshift-azure/pkg/config/v71"
v9 "github.com/openshift/openshift-azure/pkg/config/v9"
)
type Interface interface {
Generate(template *pluginapi.Config, setVersionFields bool) error
InvalidateSecrets() error
InvalidateCertificates() error
}
func New(cs *api.OpenShiftManagedCluster) (Interface, error) {
switch cs.Config.PluginVersion {
case "v7.0":
return v7.New(cs), nil
case "v7.1":
return v71.New(cs), nil
case "v9.0":
return v9.New(cs), nil
case "v10.0", "v10.1":
return v10.New(cs), nil
}
return nil, fmt.Errorf("version %q not found", cs.Config.PluginVersion)
}