Skip to content

Instantly share code, notes, and snippets.

@maelvls
Last active January 7, 2022 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maelvls/351c438f533f43cbb76bf9e93936e4c4 to your computer and use it in GitHub Desktop.
Save maelvls/351c438f533f43cbb76bf9e93936e4c4 to your computer and use it in GitHub Desktop.

Understanding cert-manager upgrade issues to 1.7

When upgrading from 0.16.1 to v1.6.1

Users will start seeing errors whenever a client tries to apply or create a v1alpha2 resource:

TODO paste the error here

The curl commands below require you to run kubectl proxy in the background.

curl -sS -H "Content-Type: application/json-patch+json" -X PATCH http://localhost:8001/apis/cert-manager.io/v1/namespaces/default/certificates/smoketest-cert/status -d "[{"op": "replace", "path": "/status/conditions", "value":[{"type": "Issuing", "status": "True"}]}]"
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "conversion webhook for cert-manager.io/v1alpha2, Kind=Certificate failed: the server rejected our request for an unknown reason",
  "code": 500
}

But the second time, it works:

curl -sS -H "Content-Type: application/json-patch+json" -X PATCH http://localhost:8001/apis/cert-manager.io/v1/namespaces/default/certificates/smoketest-cert/status -d '[{"op": "replace", "path": "/status/conditions", "value":[{"type": "Issuing", "status": "True"}]}]' | jq

{
  "apiVersion": "cert-manager.io/v1",
  "kind": "Certificate",
  "metadata": {
    "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"cert-manager.io/v1alpha2\",\"kind\":\"Certificate\",\"metadata\":{\"annotations\":{},\"name\":\"smoketest-cert\",\"namespace\":\"default\"},\"spec\":{\"commonName\":\"smoketest-cert\",\"dnsNames\":[\"example.com\"],\"issuerRef\":{\"kind\":\"Issuer\",\"name\":\"smoketest-selfsigned-issuer\"},\"secretName\":\"smoketest-cert-tls\"}}\n"
    },
    "creationTimestamp": "2022-01-05T08:35:33Z",
    "generation": 1,
    "managedFields": [
      {
        "apiVersion": "cert-manager.io/v1alpha2",
        "fieldsType": "FieldsV1",
        "fieldsV1": {
          "f:metadata": {
            "f:annotations": {
              ".": {},
              "f:kubectl.kubernetes.io/last-applied-configuration": {}
            }
          },
          "f:spec": {
            ".": {},
            "f:commonName": {},
            "f:dnsNames": {},
            "f:issuerRef": {
              ".": {},
              "f:kind": {},
              "f:name": {}
            },
            "f:secretName": {}
          }
        },
        "manager": "kubectl-client-side-apply",
        "operation": "Update",
        "time": "2022-01-05T08:35:33Z"
      },
      {
        "apiVersion": "cert-manager.io/v1alpha2",
        "fieldsType": "FieldsV1",
        "fieldsV1": {
          "f:status": {
            ".": {},
            "f:notAfter": {},
            "f:notBefore": {},
            "f:renewalTime": {},
            "f:revision": {}
          }
        },
        "manager": "controller",
        "operation": "Update",
        "time": "2022-01-05T08:35:34Z"
      },
      {
        "apiVersion": "cert-manager.io/v1",
        "fieldsType": "FieldsV1",
        "fieldsV1": {
          "f:status": {
            "f:conditions": {}
          }
        },
        "manager": "curl",
        "operation": "Update",
        "time": "2022-01-05T08:36:28Z"
      }
    ],
    "name": "smoketest-cert",
    "namespace": "default",
    "resourceVersion": "1100",
    "uid": "36395bdf-050e-43d5-b6bf-88bac0f0e9fe"
  },
  "spec": {
    "commonName": "smoketest-cert",
    "dnsNames": [
      "example.com"
    ],
    "issuerRef": {
      "kind": "Issuer",
      "name": "smoketest-selfsigned-issuer"
    },
    "secretName": "smoketest-cert-tls"
  },
  "status": {
    "conditions": [
      {
        "status": "True",
        "type": "Issuing"
      }
    ],
    "notAfter": "2022-04-05T08:35:33Z",
    "notBefore": "2022-01-05T08:35:33Z",
    "renewalTime": "2022-03-06T08:35:33Z",
    "revision": 1
  }
}

Notice how the version changed to v1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment