rancher / webhook

Rancher webhook for Kubernetes
Apache License 2.0
22 stars 64 forks source link

[release/v0.4] Fix webhook not deployed in CI #508

Open tomleb opened 2 weeks ago

tomleb commented 2 weeks ago

Backport

Backport of https://github.com/rancher/webhook/pull/503

You can make changes to this PR with the following command:

git clone https://github.com/rancher/webhook
cd webhook
git switch backport-503-release-v0.4-24683

Issue https://github.com/rancher/rancher/issues/47062

The deployment logic in r/r is a little complex for webhook.

Rancher has the rancher-webhook charts bundled in its image. Depending on timing and how well our git mirror is doing, Rancher might try to deploy the rancher-webhook chart embedded in the image, or it might deploy the chart pulled from the charts repo.

When it's pulling from the charts repo, then the webhook RC version in CATTLE_RANCHER_WEBHOOK_VERSION might be stale compared to the on in the charts repo. This leads to Rancher not being able to deploy webhook.

When using the bundled rancher-webhook chart, there's a very small chance that the bundled repo has a newer version of rancher-webhook than the one set in CATTLE_RANCHER_WEBHOOK_VERSION.

For the purpose of setting up Rancher for our tests, we really don't care what webhook version is installed because we'll be deploying the one from the PR anyway. So to eliminate these issues, we simply set CATTLE_RANCHER_WEBHOOK_VERSION to empty "". Rancher will then deploy the latest version of webhook it can find in the index chart, whether its from bundled or from git mirror.