snowdrop / godaddy-webhook

Cert Manager Godaddy Webhook performing ACME challenge using DNS record
Apache License 2.0
72 stars 62 forks source link

Test fails "Unauthorized : Could not authenticate API key/secret" #7

Closed cmoulliard closed 2 years ago

cmoulliard commented 2 years ago

Issue

Check why test is failing

 TEST_ZONE_NAME=example.com. go test .
I0124 11:04:18.792981   50890 request.go:968] Request Body: {"kind":"Namespace","apiVersion":"v1","metadata":{"name":"basic-present-record","creationTimestamp":null},"spec":{},"status":{}}
I0124 11:04:18.793342   50890 round_trippers.go:423] curl -k -v -XPOST  -H "Accept: application/json, */*" -H "Content-Type: application/json" -H "User-Agent: godaddy-webhook.test/v0.0.0 (darwin/amd64) kubernetes/$Format" 'http://127.0.0.1:52351/api/v1/namespaces'
I0124 11:04:18.813686   50890 round_trippers.go:443] POST http://127.0.0.1:52351/api/v1/namespaces 201 Created in 20 milliseconds
I0124 11:04:18.813719   50890 round_trippers.go:449] Response Headers:
I0124 11:04:18.813725   50890 round_trippers.go:452]     Content-Type: application/json
I0124 11:04:18.813730   50890 round_trippers.go:452]     Date: Mon, 24 Jan 2022 10:04:18 GMT
I0124 11:04:18.813734   50890 round_trippers.go:452]     Content-Length: 311
I0124 11:04:18.813848   50890 request.go:968] Response Body: {"kind":"Namespace","apiVersion":"v1","metadata":{"name":"basic-present-record","selfLink":"/api/v1/namespaces/basic-present-record","uid":"feac3c42-7cfc-11ec-8f9c-acde48001122","resourceVersion":"41","creationTimestamp":"2022-01-24T10:04:18Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}}
I0124 11:04:21.968608   50890 round_trippers.go:423] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: godaddy-webhook.test/v0.0.0 (darwin/amd64) kubernetes/$Format" 'http://127.0.0.1:52351/api/v1/namespaces/basic-present-record/secrets/dummy'
I0124 11:04:21.969653   50890 round_trippers.go:443] GET http://127.0.0.1:52351/api/v1/namespaces/basic-present-record/secrets/dummy 200 OK in 1 milliseconds
I0124 11:04:21.969676   50890 round_trippers.go:449] Response Headers:
I0124 11:04:21.969681   50890 round_trippers.go:452]     Content-Type: application/json
I0124 11:04:21.969685   50890 round_trippers.go:452]     Date: Mon, 24 Jan 2022 10:04:21 GMT
I0124 11:04:21.969689   50890 round_trippers.go:452]     Content-Length: 652
I0124 11:04:21.969738   50890 request.go:968] Response Body: {"kind":"Secret","apiVersion":"v1","metadata":{"name":"dummy","namespace":"basic-present-record","selfLink":"/api/v1/namespaces/basic-present-record/secrets/dummy","uid":"fff4706a-7cfc-11ec-8f9c-acde48001122","resourceVersion":"46","creationTimestamp":"2022-01-24T10:04:20Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Secret\",\"metadata\":{\"annotations\":{},\"name\":\"dummy\",\"namespace\":\"basic-present-record\"},\"stringData\":{\"token\":\"\\u003cGODADDY_KEY:GODADDY_SECRET\\u003e\"},\"type\":\"Opaque\"}\n"}},"data":{"token":"PEdPREFERFlfS0VZOkdPREFERFlfU0VDUkVUPg=="},"type":"Opaque"}
I0124 11:04:22.331042   50890 wait.go:344] Returning discovered zone record "example.com." for fqdn "example.com."
I0124 11:04:22.678065   50890 round_trippers.go:423] curl -k -v -XDELETE  -H "Accept: application/json, */*" -H "User-Agent: godaddy-webhook.test/v0.0.0 (darwin/amd64) kubernetes/$Format" 'http://127.0.0.1:52351/api/v1/namespaces/basic-present-record'
I0124 11:04:22.683054   50890 round_trippers.go:443] DELETE http://127.0.0.1:52351/api/v1/namespaces/basic-present-record 200 OK in 4 milliseconds
I0124 11:04:22.683078   50890 round_trippers.go:449] Response Headers:
I0124 11:04:22.683088   50890 round_trippers.go:452]     Content-Type: application/json
I0124 11:04:22.683095   50890 round_trippers.go:452]     Date: Mon, 24 Jan 2022 10:04:22 GMT
I0124 11:04:22.683111   50890 round_trippers.go:452]     Content-Length: 359
I0124 11:04:22.683166   50890 request.go:968] Response Body: {"kind":"Namespace","apiVersion":"v1","metadata":{"name":"basic-present-record","selfLink":"/api/v1/namespaces/basic-present-record","uid":"feac3c42-7cfc-11ec-8f9c-acde48001122","resourceVersion":"47","creationTimestamp":"2022-01-24T10:04:18Z","deletionTimestamp":"2022-01-24T10:04:22Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Terminating"}}
--- FAIL: TestRunsSuite (9.36s)
    fixture.go:116: started apiserver on "http://127.0.0.1:52351"
    --- FAIL: TestRunsSuite/Conformance (3.89s)
        --- FAIL: TestRunsSuite/Conformance/Basic (3.89s)
            --- FAIL: TestRunsSuite/Conformance/Basic/PresentRecord (3.89s)
                util.go:61: skipping file "testdata/godaddy/README.md" with unrecognised extension
                util.go:70: created fixture "basic-present-record"
                suite.go:37: Calling Present with ChallengeRequest: &v1alpha1.ChallengeRequest{UID:"", Action:"", Type:"", DNSName:"example.com", Key:"123d==", ResourceNamespace:"basic-present-record", ResolvedFQDN:"cert-manager-dns01-tests.example.com.", ResolvedZone:"example.com.", AllowAmbientCredentials:false, Config:(*v1beta1.JSON)(0xc000716798)}
                suite.go:40: expected Present to not error, but got: could not create record [{"type":"TXT","name":"cert-manager-dns01-tests","data":"123d==","ttl":600}]; Status: 401; Body: {"code":"UNABLE_TO_AUTHENTICATE","message":"Unauthorized : Could not authenticate API key/secret"}
FAIL
FAIL    github.com/snowdrop/godaddy-webhook     10.086s
FAIL
cmoulliard commented 2 years ago

Problem fixed as the godaddy api key and secret was not defined part of the secret.yaml file. Instructions have been updated