Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/asset/installconfig/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func (a *InstallConfig) Generate(parents asset.Parents) error {
)

a.Config = &types.InstallConfig{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1beta1",
},
ObjectMeta: metav1.ObjectMeta{
Name: clusterName.ClusterName,
},
Expand Down
10 changes: 10 additions & 0 deletions pkg/asset/installconfig/installconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import (

func validInstallConfig() *types.InstallConfig {
return &types.InstallConfig{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1beta1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "test-cluster",
},
Expand Down Expand Up @@ -54,6 +57,9 @@ func TestInstallConfigGenerate_FillsInDefaults(t *testing.T) {
t.Errorf("unexpected error generating install config: %v", err)
}
expected := &types.InstallConfig{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1beta1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "test-cluster",
},
Expand Down Expand Up @@ -99,6 +105,7 @@ func TestInstallConfigLoad(t *testing.T) {
{
name: "valid InstallConfig",
data: `
apiVersion: v1beta1
metadata:
name: test-cluster
baseDomain: test-domain
Expand All @@ -109,6 +116,9 @@ pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}"
`,
expectedFound: true,
expectedConfig: &types.InstallConfig{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1beta1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "test-cluster",
},
Expand Down
10 changes: 10 additions & 0 deletions pkg/types/validation/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ import (
"github.com/openshift/installer/pkg/validate"
)

const (
installConfigVersion = "v1beta1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to SemVer this to make it easier to see feature additions? Or will we not bump on feature additions and only bunp this for backwards-incompatible changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally going to use semver, but then decided with K8S versioning. This was just done for continuity with the rest of the ecosystem. If we were to adopt semver instead, would you still want to use the same field, or should we create a different version field?

Copy link
Member

@wking wking Jan 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally going to use semver, but then decided with K8S versioning.

Either is fine with me, I just want to know what the plan is ;).

This was just done for continuity with the rest of the ecosystem. If we were to adopt semver instead, would you still want to use the same field, or should we create a different version field?

I'm fine using this field for whatever version strings we pick.

)

// ValidateInstallConfig checks that the specified install config is valid.
func ValidateInstallConfig(c *types.InstallConfig, openStackValidValuesFetcher openstackvalidation.ValidValuesFetcher) field.ErrorList {
allErrs := field.ErrorList{}
if c.TypeMeta.APIVersion == "" {
return field.ErrorList{field.Required(field.NewPath("apiVersion"), "install-config version required")}
}
if c.TypeMeta.APIVersion != installConfigVersion {
return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), c.TypeMeta.APIVersion, fmt.Sprintf("install-config version must be %q", installConfigVersion))}
}
if c.ObjectMeta.Name == "" {
allErrs = append(allErrs, field.Required(field.NewPath("metadata", "name"), "cluster name required"))
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/types/validation/installconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import (

func validInstallConfig() *types.InstallConfig {
return &types.InstallConfig{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1beta1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "test-cluster",
},
Expand Down