1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-01 15:06:23 +00:00

Updated cluster/addons.go to allow it to parse and send new http_port and https_ports to the ingress template

Fixed up yaml import package

Updated rke ingress addon to support a new field hostNetwork. Users can use this now to run ingress controller on overlay network only

Ported additional ingress types changes into types/rke_types

Fixed linting errors related to variable names in addons.go and rke_types

Changed types for hostNetwork and http/https ports

Added validation to check http/https ports are different

Changed rke_types for additional spec in ingressConfig. Changed validation and default logic accordingly
This commit is contained in:
Gaurav Mehta
2020-02-13 16:27:12 +11:00
committed by Gaurav Mehta
parent 33c69c0108
commit 5a63de09bc
5 changed files with 51 additions and 0 deletions

View File

@@ -177,6 +177,24 @@ func validateIngressOptions(c *Cluster) error {
return fmt.Errorf("DNSPolicy %s was not a valid DNS Policy", c.Ingress.DNSPolicy)
}
if c.Ingress.NetworkMode == "hostPort" {
if !(c.Ingress.HTTPPort >= 0 && c.Ingress.HTTPPort <= 65535) {
return fmt.Errorf("https port is invalid. Needs to be within 0 to 65535")
}
if !(c.Ingress.HTTPPort >= 0 && c.Ingress.HTTPPort <= 65535) {
return fmt.Errorf("http port is invalid. Needs to be within 0 to 65535")
}
if c.Ingress.HTTPPort != 0 && c.Ingress.HTTPSPort != 0 &&
(c.Ingress.HTTPPort == c.Ingress.HTTPSPort) {
return fmt.Errorf("http and https ports need to be different")
}
}
if !(c.Ingress.NetworkMode == "" ||
c.Ingress.NetworkMode == "hostNetwork" || c.Ingress.NetworkMode == "hostPort" ||
c.Ingress.NetworkMode == "none") {
return fmt.Errorf("NetworkMode %s was not a valid network mode", c.Ingress.NetworkMode)
}
return nil
}