diff --git a/bootstrap/pkg/apis/apps/configconverters/testdata/kfconfig_v1beta1.yaml b/bootstrap/pkg/apis/apps/configconverters/testdata/kfconfig_v1beta1.yaml index adf0790117e..d77930418e4 100644 --- a/bootstrap/pkg/apis/apps/configconverters/testdata/kfconfig_v1beta1.yaml +++ b/bootstrap/pkg/apis/apps/configconverters/testdata/kfconfig_v1beta1.yaml @@ -7,6 +7,7 @@ metadata: spec: project: foo-project email: foo@gmail.com + platform: gcp applications: - kustomizeConfig: parameters: diff --git a/bootstrap/pkg/apis/apps/configconverters/v1beta1.go b/bootstrap/pkg/apis/apps/configconverters/v1beta1.go index d23d99a6861..be7a1841780 100644 --- a/bootstrap/pkg/apis/apps/configconverters/v1beta1.go +++ b/bootstrap/pkg/apis/apps/configconverters/v1beta1.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/ghodss/yaml" kfapis "github.com/kubeflow/kubeflow/bootstrap/v3/pkg/apis" + kftypesv3 "github.com/kubeflow/kubeflow/bootstrap/v3/pkg/apis/apps" kfconfig "github.com/kubeflow/kubeflow/bootstrap/v3/pkg/apis/apps/kfconfig" kfdeftypes "github.com/kubeflow/kubeflow/bootstrap/v3/pkg/apis/apps/kfdef/v1beta1" ) @@ -12,6 +13,21 @@ import ( type V1beta1 struct { } +func maybeGetPlatform(pluginKind string) string { + platforms := map[string]string{ + string(kfconfig.AWS_PLUGIN_KIND): kftypesv3.AWS, + string(kfconfig.GCP_PLUGIN_KIND): kftypesv3.GCP, + string(kfconfig.EXISTING_ARRIKTO_PLUGIN_KIND): kftypesv3.EXISTING_ARRIKTO, + } + + p, ok := platforms[pluginKind] + if ok { + return p + } else { + return "" + } +} + func (v V1beta1) ToKfConfig(appdir string, kfdefBytes []byte) (*kfconfig.KfConfig, error) { kfdef := &kfdeftypes.KfDef{} if err := yaml.Unmarshal(kfdefBytes, kfdef); err != nil { @@ -109,6 +125,9 @@ func (v V1beta1) ToKfConfig(appdir string, kfdefBytes []byte) (*kfconfig.KfConfi config.Spec.Zone = z.(string) } } + if p := maybeGetPlatform(plugin.Kind); p != "" { + config.Spec.Platform = p + } } for _, secret := range kfdef.Spec.Secrets { @@ -204,6 +223,7 @@ func (v V1beta1) ToKfDefSerialized(config kfconfig.KfConfig) ([]byte, error) { Spec: plugin.Spec, } p.Name = plugin.Name + p.Kind = string(plugin.Kind) kfdef.Spec.Plugins = append(kfdef.Spec.Plugins, p) }