Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if vip interface exists #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion apis/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package apis

import (
"fmt"
"net"

"github.com/platform9/nodeadm/constants"
)
Expand All @@ -23,13 +24,20 @@ func ValidateInit(config *InitConfiguration) []error {
} else {
// Pod subnet was set through MasterConfiguration.Networking.PodSubnet
if config.MasterConfiguration.Networking.PodSubnet != config.Networking.PodSubnet {
errorList = append(errorList, fmt.Errorf("Configuration conflict: Networking.PodSubnet=%q, MasterConfiguration.Networking.PodSubnet=%q. Values should be identical, or MasterConfiguration.Networking.PodSubnet omitted.",
errorList = append(errorList, fmt.Errorf("configuration conflict: Networking.PodSubnet=%q, MasterConfiguration.Networking.PodSubnet=%q. Values should be identical, or MasterConfiguration.Networking.PodSubnet omitted",
config.Networking.PodSubnet, config.MasterConfiguration.Networking.PodSubnet))
}
}
if config.MasterConfiguration.Networking.DNSDomain != config.Networking.DNSDomain {
errorList = append(errorList, fmt.Errorf("configuration conflict: Networking.DNSDomain=%q, MasterConfiguration.Networking.DNSDomain=%q. Values should be identical, or MasterConfiguration.Networking.DNSDomain omitted",
config.Networking.DNSDomain, config.MasterConfiguration.Networking.DNSDomain))
}
if config.VIPConfiguration.RouterID != -1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi Ojas, just curious why not look for NetworkInterface itself here, i think we have a separate check where we verify that both RouterID and NetworkInterface are provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea was to only error here if this cluster is intended to be HA. If interface is empty, it could be done intentionally for a non-HA cluster.

iface := config.VIPConfiguration.NetworkInterface
_, err := net.InterfaceByName(iface)
if err != nil {
errorList = append(errorList, fmt.Errorf("configuration conflict: VIPConfiguration.NetworkInterface=%q. %v", iface, err))
}
}
return errorList
}