cert-manager / webhook-example

A cert-manager sample repository for creating an ACME DNS01 solver webhook
Apache License 2.0
102 stars 405 forks source link

Doesn't work with go versions >1.19 #53

Closed irreleph4nt closed 10 months ago

irreleph4nt commented 12 months ago

I have forked this repo to implement a custom solver for desec, but found myself unable to deploy a working instance on my up-to-date Debian system. The issue has been pinpointed as the go version used for implementing the hook, as an updated version will necessitate an update in the Dockerfile as well. The same problem was encountered by another user in #27

Steps to reproduce:

  1. Install a version of go > 1.19 on a development machine
  2. Implement a hook
  3. Run go module init
  4. Run go mod tidy
  5. Extract go version from go.mod file and update the Dockerfile's FROM reference with it, i.e. set FROM golang:1.21-alpine3.18 AS build_dep
  6. Build docker image for hook
  7. Deploy hook

Expected Result:

The hook is deployed and the relevant cert-manager resources are up and running.

Actual Result:

The webhook pod does not start and ends in a CrashLoopBackOff state. Reviewing its logs, the following error shows up: cert-manager: error executing command" err="error installing APIGroup for solvers: unable to get openapi models: OpenAPIV3 config must not be nil

Outcome:

Developers are forced to use either one of two ugly workarounds:

  1. Install an old and outdated version of go (i.e. v1.19) on your system before you start implementing a hook
  2. Diff your go.mod and go.sum files to those of another hook implemented in go v1.19, merging the newly added lines of your project into the existing lines of another working project, leaving the FROM reference in the Dockerfile at go v1.19
SgtCoDFish commented 10 months ago

Thank you for raising this @irreleph4nt ! I'm going to close in favour of #27 since that has a bunch of discussion - any fix for #27 will make sure this builds using go 1.21 (since that's what we're generally using to develop other cert-manager subprojects).

Thanks again!