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

RKE host structure and config changes #56

Merged
merged 2 commits into from
Nov 28, 2017

Conversation

galal-hussein
Copy link
Contributor

@galal-hussein galal-hussein commented Nov 28, 2017

#53
#52
#50
#41
#36

  • IP to Address
  • AdvertiseAddress to InternalAddress
  • AdvertisedHostname to HostnameOverride

Hostname will be optional, and if not set it will be equal to Address.

@galal-hussein galal-hussein changed the title WIP: Config changes Config changes Nov 28, 2017
@galal-hussein
Copy link
Contributor Author

galal-hussein commented Nov 28, 2017

rancher/types#25

@alena1108 @moelsayed Can you please review?

@galal-hussein galal-hussein changed the title Config changes RKE host structure and config changes Nov 28, 2017
@galal-hussein galal-hussein force-pushed the config_changes branch 2 times, most recently from 363ff98 to 7bf08eb Compare November 28, 2017 19:55
@@ -90,7 +90,7 @@ func IsHostListChanged(currentHosts, configHosts []Host) bool {
for _, host := range currentHosts {
found := false
for _, configHost := range configHosts {
if host.AdvertisedHostname == configHost.AdvertisedHostname {
if host.Address == configHost.Address {
found = true

Choose a reason for hiding this comment

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

we should break when found=true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it

if role == services.ControlRole {
bothRoles[services.ControlRole] = true
}
if role == services.WorkerRole {

Choose a reason for hiding this comment

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

should be elseif

return fmt.Errorf("Role [%s] for host (%d) is not recognized", role, i+1)
}
}
bothRoles := make(map[string]bool)

Choose a reason for hiding this comment

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

any reason why we use a map here? there are only 2 values, workerRole and controlRole, may be can use bool instead to simplify the outlook?

@@ -13,16 +15,79 @@ func (c *Cluster) ValidateCluster() error {
if len(c.EtcdHosts) == 0 {

Choose a reason for hiding this comment

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

Should we validate number of etcd hosts (it should be an odd number)?

}

func validateNetworkOptions(c *Cluster) error {
if c.Network.Plugin != "flannel" && c.Network.Plugin != "calico" && c.Network.Plugin != "canal" {

Choose a reason for hiding this comment

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

I suggest you define the constants for the network plugins.

)

func (c *Cluster) ValidateCluster() error {
// make sure cluster has at least one controlplane/etcd host
if len(c.ControlPlaneHosts) == 0 {
return fmt.Errorf("Cluster must have at least one control plane host")
}
if len(c.EtcdHosts) == 0 {
return fmt.Errorf("Cluster must have at least one etcd host")
if len(c.EtcdHosts)%2 == 0 {

Choose a reason for hiding this comment

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

what if len is 0?

@alena1108 alena1108 merged commit 5842cd8 into rancher:master Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants