mirror of
https://github.com/rancher/rke.git
synced 2025-09-01 15:06:23 +00:00
Validate Ingress Webhook and pass to template
This commit is contained in:
@@ -580,6 +580,25 @@ func validateIngressImages(c *Cluster) error {
|
||||
if len(c.SystemImages.IngressBackend) == 0 {
|
||||
return errors.New("ingress backend image is not populated")
|
||||
}
|
||||
// Ingress Webhook image is used starting with k8s 1.21
|
||||
k8sVersion := c.RancherKubernetesEngineConfig.Version
|
||||
toMatch, err := semver.Make(k8sVersion[1:])
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s is not valid semver", k8sVersion)
|
||||
}
|
||||
logrus.Debugf("Checking if ingress webhook image is required for cluster version [%s]", k8sVersion)
|
||||
|
||||
IngressWebhookImageRequiredRange, err := semver.ParseRange(">=1.21.0-rancher0")
|
||||
if err != nil {
|
||||
logrus.Warnf("Failed to parse semver range for checking required ingress webhook image")
|
||||
}
|
||||
if IngressWebhookImageRequiredRange(toMatch) {
|
||||
logrus.Debugf("Cluster version [%s] uses ingress webhook image, checking if image is populated", k8sVersion)
|
||||
if len(c.SystemImages.IngressWebhook) == 0 {
|
||||
return errors.New("ingress webhook image is not populated")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user