1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-01 23:16:22 +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

@@ -514,6 +514,9 @@ func parseIngressConfig(clusterFile string, rkeConfig *v3.RancherKubernetesEngin
if err := parseIngressExtraVolumeMounts(ingressMap, rkeConfig); err != nil {
return err
}
if err := parseIngressDefaults(ingressMap, rkeConfig); err != nil {
return err
}
return nil
}
@@ -598,6 +601,21 @@ func parseIngressExtraVolumeMounts(ingressMap map[string]interface{}, rkeConfig
return nil
}
func parseIngressDefaults(ingressMap map[string]interface{}, rkeConfig *v3.RancherKubernetesEngineConfig) error {
// Setting up default behaviour so as to not catch out
// existing users who use new version of RKE
if _, ok := ingressMap["network_mode"]; !ok {
rkeConfig.Ingress.NetworkMode = DefaultNetworkMode
}
if _, ok := ingressMap["http_port"]; !ok {
rkeConfig.Ingress.HTTPPort = DefaultHTTPPort
}
if _, ok := ingressMap["https_port"]; !ok {
rkeConfig.Ingress.HTTPSPort = DefaultHTTPSPort
}
return nil
}
func parseNodeDrainInput(clusterFile string, rkeConfig *v3.RancherKubernetesEngineConfig) error {
// setting some defaults here because for these fields there's no way of differentiating between user provided null value vs golang setting it to null during unmarshal
if rkeConfig.UpgradeStrategy == nil || rkeConfig.UpgradeStrategy.DrainInput == nil {