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

Merge pull request #2599 from superseb/ingress_webhook

Validate Ingress Webhook and pass to template
This commit is contained in:
Sebastiaan van Steenis
2021-07-06 22:53:46 +02:00
committed by GitHub
4 changed files with 24 additions and 0 deletions

View File

@@ -610,6 +610,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
}