mirror of
https://github.com/rancher/rke.git
synced 2025-09-17 15:40:07 +00:00
Merge pull request #2776 from superseb/v13_watchingresswithoutclass
[release/v1.3] Set 'watch-ingress-without-class: true' as default
This commit is contained in:
@@ -613,9 +613,21 @@ func (c *Cluster) deployIngress(ctx context.Context, data map[string]interface{}
|
|||||||
}
|
}
|
||||||
// since nginx ingress controller 0.16.0, it can be run as non-root and doesn't require privileged anymore.
|
// since nginx ingress controller 0.16.0, it can be run as non-root and doesn't require privileged anymore.
|
||||||
// So we can use securityContext instead of setting privileges via initContainer.
|
// So we can use securityContext instead of setting privileges via initContainer.
|
||||||
ingressSplits := strings.SplitN(c.SystemImages.Ingress, ":", 2)
|
// There are two formats currently in use:
|
||||||
if len(ingressSplits) == 2 {
|
// rancher/nginx-ingress-controller:0.21.0-rancher3
|
||||||
version := strings.Split(ingressSplits[1], "-")[0]
|
// rancher/nginx-ingress-controller:nginx-0.43.0-rancher1
|
||||||
|
// This code was adjusted to match both and look at the tag (last element)
|
||||||
|
ingressSplits := strings.Split(c.SystemImages.Ingress, ":")
|
||||||
|
if len(ingressSplits) >= 2 {
|
||||||
|
var version string
|
||||||
|
ingressTag := ingressSplits[len(ingressSplits)-1]
|
||||||
|
ingressTagSplits := strings.Split(ingressTag, "-")
|
||||||
|
// both formats are caught here, either first or second element based on count of elements
|
||||||
|
if len(ingressTagSplits) == 2 {
|
||||||
|
version = ingressTagSplits[0]
|
||||||
|
} else {
|
||||||
|
version = ingressTagSplits[1]
|
||||||
|
}
|
||||||
if version < "0.16.0" {
|
if version < "0.16.0" {
|
||||||
ingressConfig.AlpineImage = c.SystemImages.Alpine
|
ingressConfig.AlpineImage = c.SystemImages.Alpine
|
||||||
}
|
}
|
||||||
@@ -633,6 +645,21 @@ func (c *Cluster) deployIngress(ctx context.Context, data map[string]interface{}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// This ensures ingresses created before upgrade are watched else they would all stop working
|
||||||
|
// This is because ingressClass is required on the ingress
|
||||||
|
// User can disable it by configuring watch-ingress-without-class: "false" in extra_args for ingress
|
||||||
|
if version >= "1.1.0" {
|
||||||
|
if c.Ingress.ExtraArgs != nil {
|
||||||
|
if _, ok := c.Ingress.ExtraArgs["watch-ingress-without-class"]; !ok {
|
||||||
|
ingressConfig.ExtraArgs["watch-ingress-without-class"] = "true"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
extraArgs := map[string]string{
|
||||||
|
"watch-ingress-without-class": "true",
|
||||||
|
}
|
||||||
|
ingressConfig.ExtraArgs = extraArgs
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tmplt, err := templates.GetVersionedTemplates(kdm.NginxIngress, data, c.Version)
|
tmplt, err := templates.GetVersionedTemplates(kdm.NginxIngress, data, c.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user