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
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ then
copy_static_resources_for baremetal
copy_static_resources_for openstack
copy_static_resources_for ovirt
copy_static_resources_for vsphere

cp mco-bootstrap/manifests/* manifests/

Expand Down
7 changes: 5 additions & 2 deletions pkg/asset/ignition/machine/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
baremetaltypes "github.com/openshift/installer/pkg/types/baremetal"
openstacktypes "github.com/openshift/installer/pkg/types/openstack"
openstackdefaults "github.com/openshift/installer/pkg/types/openstack/defaults"
"github.com/openshift/installer/pkg/types/ovirt"
ovirttypes "github.com/openshift/installer/pkg/types/ovirt"
Copy link
Member

Choose a reason for hiding this comment

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

Intentionally included here?

Copy link
Member

Choose a reason for hiding this comment

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

@rgolangh FYI if so.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was standardizing the imports to use *types. I can back that out if it is an issue.

Copy link
Member

Choose a reason for hiding this comment

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

lets leave it, just wanted to make sure that it wasn't an oversight

vspheretypes "github.com/openshift/installer/pkg/types/vsphere"
)

// pointerIgnitionConfig generates a config which references the remote config
Expand All @@ -30,8 +31,10 @@ func pointerIgnitionConfig(installConfig *types.InstallConfig, rootCA []byte, ro
} else {
ignitionHost = fmt.Sprintf("api-int.%s:22623", installConfig.ClusterDomain())
}
case ovirt.Name:
case ovirttypes.Name:
ignitionHost = fmt.Sprintf("%s:22623", installConfig.Ovirt.APIVIP)
case vspheretypes.Name:
Copy link
Contributor

Choose a reason for hiding this comment

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

@mtnbikenc @vrutkovs right here is where ignition is broken. Need to add a check for empty string APIVIP

Copy link
Member Author

Choose a reason for hiding this comment

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

ignitionHost = fmt.Sprintf("%s:22623", installConfig.VSphere.APIVIP)
default:
ignitionHost = fmt.Sprintf("api-int.%s:22623", installConfig.ClusterDomain())
}
Expand Down
10 changes: 8 additions & 2 deletions pkg/asset/manifests/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import (

"github.com/ghodss/yaml"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

configv1 "github.com/openshift/api/config/v1"
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/installconfig"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

gcpmanifests "github.com/openshift/installer/pkg/asset/manifests/gcp"
"github.com/openshift/installer/pkg/types/aws"
"github.com/openshift/installer/pkg/types/azure"
Expand Down Expand Up @@ -144,6 +143,13 @@ func (i *Infrastructure) Generate(dependencies asset.Parents) error {
}
case vsphere.Name:
config.Status.PlatformStatus.Type = configv1.VSpherePlatformType
if installConfig.Config.VSphere.APIVIP != "" {
config.Status.PlatformStatus.VSphere = &configv1.VSpherePlatformStatus{
APIServerInternalIP: installConfig.Config.VSphere.APIVIP,
NodeDNSIP: installConfig.Config.VSphere.DNSVIP,
IngressIP: installConfig.Config.VSphere.IngressVIP,
}
}
case ovirt.Name:
config.Status.PlatformStatus.Type = configv1.OvirtPlatformType
config.Status.PlatformStatus.Ovirt = &configv1.OvirtPlatformStatus{
Expand Down
10 changes: 8 additions & 2 deletions pkg/asset/tls/mcscertkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package tls
import (
"crypto/x509"
"crypto/x509/pkix"
"github.com/openshift/installer/pkg/types/ovirt"
"net"

"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/installconfig"
baremetaltypes "github.com/openshift/installer/pkg/types/baremetal"
openstacktypes "github.com/openshift/installer/pkg/types/openstack"
openstackdefaults "github.com/openshift/installer/pkg/types/openstack/defaults"
ovirttypes "github.com/openshift/installer/pkg/types/ovirt"
Copy link
Member

Choose a reason for hiding this comment

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

Intentionally included here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was standardizing the imports to use *types. I can back that out if it is an issue.

vspheretypes "github.com/openshift/installer/pkg/types/vsphere"
)

// MCSCertKey is the asset that generates the MCS key/cert pair.
Expand Down Expand Up @@ -55,9 +56,14 @@ func (a *MCSCertKey) Generate(dependencies asset.Parents) error {
}
cfg.IPAddresses = []net.IP{apiVIP}
cfg.DNSNames = []string{hostname, apiVIP.String()}
case ovirt.Name:
case ovirttypes.Name:
cfg.IPAddresses = []net.IP{net.ParseIP(installConfig.Config.Ovirt.APIVIP)}
cfg.DNSNames = []string{hostname, installConfig.Config.Ovirt.APIVIP}
case vspheretypes.Name:
if installConfig.Config.VSphere.APIVIP != "" {
cfg.IPAddresses = []net.IP{net.ParseIP(installConfig.Config.VSphere.APIVIP)}
cfg.DNSNames = []string{hostname, installConfig.Config.VSphere.APIVIP}
}
default:
cfg.DNSNames = []string{hostname}
}
Expand Down
17 changes: 17 additions & 0 deletions pkg/types/vsphere/validation/platform.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package validation

import (
"strings"

"k8s.io/apimachinery/pkg/util/validation/field"

"github.com/openshift/installer/pkg/types/vsphere"
"github.com/openshift/installer/pkg/validate"
)

// ValidatePlatform checks that the specified platform is valid.
Expand All @@ -24,5 +27,19 @@ func ValidatePlatform(p *vsphere.Platform, fldPath *field.Path) field.ErrorList
if len(p.DefaultDatastore) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("defaultDatastore"), "must specify the default datastore"))
}

// If all VIPs are empty, skip IP validation. All VIPs are required to be defined together.
if strings.Join([]string{p.APIVIP, p.IngressVIP, p.DNSVIP}, "") != "" {
if err := validate.IP(p.APIVIP); err != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("apiVIP"), p.APIVIP, err.Error()))
}
if err := validate.IP(p.IngressVIP); err != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("ingressVIP"), p.IngressVIP, err.Error()))
}
if err := validate.IP(p.DNSVIP); err != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("dnsVIP"), p.DNSVIP, err.Error()))
}
}

return allErrs
}
44 changes: 44 additions & 0 deletions pkg/types/vsphere/validation/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,50 @@ func TestValidatePlatform(t *testing.T) {
}(),
expectedError: `^test-path\.defaultDatastore: Required value: must specify the default datastore$`,
},
{
name: "valid VIPs",
platform: func() *vsphere.Platform {
p := validPlatform()
p.APIVIP = "192.168.111.2"
p.IngressVIP = "192.168.111.3"
p.DNSVIP = "192.168.111.4"
return p
}(),
// expectedError: `^test-path\.apiVIP: Invalid value: "": "" is not a valid IP`,
},
{
name: "missing API VIP",
platform: func() *vsphere.Platform {
p := validPlatform()
p.APIVIP = ""
p.IngressVIP = "192.168.111.3"
p.DNSVIP = "192.168.111.4"
return p
}(),
expectedError: `^test-path\.apiVIP: Invalid value: "": "" is not a valid IP`,
},
{
name: "missing Ingress VIP",
platform: func() *vsphere.Platform {
p := validPlatform()
p.APIVIP = "192.168.111.2"
p.IngressVIP = ""
p.DNSVIP = "192.168.111.4"
return p
}(),
expectedError: `^test-path\.ingressVIP: Invalid value: "": "" is not a valid IP`,
},
{
name: "missing DNS VIP",
platform: func() *vsphere.Platform {
p := validPlatform()
p.APIVIP = "192.168.111.2"
p.IngressVIP = "192.168.111.3"
p.DNSVIP = ""
return p
}(),
expectedError: `^test-path\.dnsVIP: Invalid value: "": "" is not a valid IP`,
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading